@@ 766-791 (lines=26) @@ | ||
763 | value='Host dead', |
|
764 | ) |
|
765 | ||
766 | @patch('ospd_openvas.daemon.BaseDB') |
|
767 | @patch('ospd_openvas.daemon.ResultList.add_scan_error_to_list') |
|
768 | def test_get_openvas_result_host_deny( |
|
769 | self, mock_add_scan_error_to_list, MockDBClass |
|
770 | ): |
|
771 | w = DummyDaemon() |
|
772 | ||
773 | target_element = w.create_xml_target() |
|
774 | targets = OspRequest.process_target_element(target_element) |
|
775 | w.create_scan('123-456', targets, None, []) |
|
776 | ||
777 | results = [ |
|
778 | "ERRMSG|||127.0.0.1|||localhost|||||||||Host access denied.", |
|
779 | ] |
|
780 | MockDBClass.get_result.return_value = results |
|
781 | mock_add_scan_error_to_list.return_value = None |
|
782 | ||
783 | w.report_openvas_results(MockDBClass, '123-456') |
|
784 | mock_add_scan_error_to_list.assert_called_with( |
|
785 | host='127.0.0.1', |
|
786 | hostname='localhost', |
|
787 | name='', |
|
788 | port='', |
|
789 | test_id='', |
|
790 | uri='', |
|
791 | value='Host access denied.', |
|
792 | ) |
|
793 | ||
794 | @patch('ospd_openvas.daemon.BaseDB') |
|
@@ 738-762 (lines=25) @@ | ||
735 | ||
736 | w.feed_is_outdated.assert_not_called() |
|
737 | ||
738 | @patch('ospd_openvas.daemon.BaseDB') |
|
739 | @patch('ospd_openvas.daemon.ResultList.add_scan_log_to_list') |
|
740 | def test_get_openvas_result(self, mock_add_scan_log_to_list, MockDBClass): |
|
741 | w = DummyDaemon() |
|
742 | ||
743 | target_element = w.create_xml_target() |
|
744 | targets = OspRequest.process_target_element(target_element) |
|
745 | w.create_scan('123-456', targets, None, []) |
|
746 | ||
747 | results = [ |
|
748 | "LOG|||192.168.0.1|||localhost|||general/Host_Details||||||Host" |
|
749 | " dead", |
|
750 | ] |
|
751 | MockDBClass.get_result.return_value = results |
|
752 | mock_add_scan_log_to_list.return_value = None |
|
753 | ||
754 | w.report_openvas_results(MockDBClass, '123-456') |
|
755 | mock_add_scan_log_to_list.assert_called_with( |
|
756 | host='192.168.0.1', |
|
757 | hostname='localhost', |
|
758 | name='', |
|
759 | port='general/Host_Details', |
|
760 | qod='', |
|
761 | test_id='', |
|
762 | uri='', |
|
763 | value='Host dead', |
|
764 | ) |
|
765 |