Code Duplication    Length = 25-26 lines in 2 locations

tests/test_daemon.py 2 locations

@@ 803-828 (lines=26) @@
800
            value='Host dead',
801
        )
802
803
    @patch('ospd_openvas.daemon.BaseDB')
804
    @patch('ospd_openvas.daemon.ResultList.add_scan_error_to_list')
805
    def test_get_openvas_result_host_deny(
806
        self, mock_add_scan_error_to_list, MockDBClass
807
    ):
808
        w = DummyDaemon()
809
810
        target_element = w.create_xml_target()
811
        targets = OspRequest.process_target_element(target_element)
812
        w.create_scan('123-456', targets, None, [])
813
814
        results = [
815
            "ERRMSG|||127.0.0.1|||localhost|||||||||Host access denied.",
816
        ]
817
        MockDBClass.get_result.return_value = results
818
        mock_add_scan_error_to_list.return_value = None
819
820
        w.report_openvas_results(MockDBClass, '123-456')
821
        mock_add_scan_error_to_list.assert_called_with(
822
            host='127.0.0.1',
823
            hostname='localhost',
824
            name='',
825
            port='',
826
            test_id='',
827
            uri='',
828
            value='Host access denied.',
829
        )
830
831
    @patch('ospd_openvas.daemon.BaseDB')
@@ 776-800 (lines=25) @@
773
        self.assertFalse(res)
774
        w.feed_is_outdated.assert_not_called()
775
776
    @patch('ospd_openvas.daemon.BaseDB')
777
    @patch('ospd_openvas.daemon.ResultList.add_scan_log_to_list')
778
    def test_get_openvas_result(self, mock_add_scan_log_to_list, MockDBClass):
779
        w = DummyDaemon()
780
781
        target_element = w.create_xml_target()
782
        targets = OspRequest.process_target_element(target_element)
783
        w.create_scan('123-456', targets, None, [])
784
785
        results = [
786
            "LOG|||192.168.0.1|||localhost|||general/Host_Details||||||Host dead",
787
        ]
788
        MockDBClass.get_result.return_value = results
789
        mock_add_scan_log_to_list.return_value = None
790
791
        w.report_openvas_results(MockDBClass, '123-456')
792
        mock_add_scan_log_to_list.assert_called_with(
793
            host='192.168.0.1',
794
            hostname='localhost',
795
            name='',
796
            port='general/Host_Details',
797
            qod='',
798
            test_id='',
799
            uri='',
800
            value='Host dead',
801
        )
802
803
    @patch('ospd_openvas.daemon.BaseDB')