@@ 736-752 (lines=17) @@ | ||
733 | ||
734 | p.kbdb.add_scan_preferences.assert_not_called() |
|
735 | ||
736 | @patch('ospd_openvas.db.KbDB') |
|
737 | def test_set_alive_no_invalid_alive_test(self, mock_kb): |
|
738 | w = DummyDaemon() |
|
739 | ||
740 | t_opt = {'alive_test': -1} |
|
741 | w.scan_collection.get_target_options = MagicMock(return_value=t_opt) |
|
742 | ||
743 | ov_setting = {'some_setting': 1} |
|
744 | ||
745 | with patch.object(Openvas, 'get_settings', return_value=ov_setting): |
|
746 | p = PreferenceHandler('1234-1234', mock_kb, w.scan_collection, None) |
|
747 | p._nvts_params = {} |
|
748 | p.scan_id = '456-789' |
|
749 | p.kbdb.add_scan_preferences = MagicMock() |
|
750 | p.prepare_alive_test_option_for_openvas() |
|
751 | ||
752 | p.kbdb.add_scan_preferences.assert_not_called() |
|
753 | ||
754 | @patch('ospd_openvas.db.KbDB') |
|
755 | def test_set_alive_no_invalid_alive_test_no_enum(self, mock_kb): |
|
@@ 719-734 (lines=16) @@ | ||
716 | ||
717 | p.kbdb.add_scan_preferences.assert_not_called() |
|
718 | ||
719 | @patch('ospd_openvas.db.KbDB') |
|
720 | def test_set_alive_no_setting(self, mock_kb): |
|
721 | w = DummyDaemon() |
|
722 | ||
723 | t_opt = {} |
|
724 | w.scan_collection.get_target_options = MagicMock(return_value=t_opt) |
|
725 | ||
726 | ov_setting = {} |
|
727 | ||
728 | with patch.object(Openvas, 'get_settings', return_value=ov_setting): |
|
729 | p = PreferenceHandler('1234-1234', mock_kb, w.scan_collection, None) |
|
730 | p.scan_id = '456-789' |
|
731 | p.kbdb.add_scan_preferences = MagicMock() |
|
732 | p.prepare_alive_test_option_for_openvas() |
|
733 | ||
734 | p.kbdb.add_scan_preferences.assert_not_called() |
|
735 | ||
736 | @patch('ospd_openvas.db.KbDB') |
|
737 | def test_set_alive_no_invalid_alive_test(self, mock_kb): |