|
@@ 758-774 (lines=17) @@
|
| 755 |
|
|
| 756 |
|
p.kbdb.add_scan_preferences.assert_not_called() |
| 757 |
|
|
| 758 |
|
@patch('ospd_openvas.db.KbDB') |
| 759 |
|
def test_set_alive_no_invalid_alive_test(self, mock_kb): |
| 760 |
|
w = DummyDaemon() |
| 761 |
|
|
| 762 |
|
t_opt = {'alive_test': -1} |
| 763 |
|
w.scan_collection.get_target_options = MagicMock(return_value=t_opt) |
| 764 |
|
|
| 765 |
|
ov_setting = {'some_setting': 1} |
| 766 |
|
|
| 767 |
|
with patch.object(Openvas, 'get_settings', return_value=ov_setting): |
| 768 |
|
p = PreferenceHandler('1234-1234', mock_kb, w.scan_collection, None) |
| 769 |
|
p._nvts_params = {} |
| 770 |
|
p.scan_id = '456-789' |
| 771 |
|
p.kbdb.add_scan_preferences = MagicMock() |
| 772 |
|
p.prepare_alive_test_option_for_openvas() |
| 773 |
|
|
| 774 |
|
p.kbdb.add_scan_preferences.assert_not_called() |
| 775 |
|
|
| 776 |
|
@patch('ospd_openvas.db.KbDB') |
| 777 |
|
def test_set_alive_no_invalid_alive_test_no_enum(self, mock_kb): |
|
@@ 741-756 (lines=16) @@
|
| 738 |
|
|
| 739 |
|
p.kbdb.add_scan_preferences.assert_not_called() |
| 740 |
|
|
| 741 |
|
@patch('ospd_openvas.db.KbDB') |
| 742 |
|
def test_set_alive_no_setting(self, mock_kb): |
| 743 |
|
w = DummyDaemon() |
| 744 |
|
|
| 745 |
|
t_opt = {} |
| 746 |
|
w.scan_collection.get_target_options = MagicMock(return_value=t_opt) |
| 747 |
|
|
| 748 |
|
ov_setting = {} |
| 749 |
|
|
| 750 |
|
with patch.object(Openvas, 'get_settings', return_value=ov_setting): |
| 751 |
|
p = PreferenceHandler('1234-1234', mock_kb, w.scan_collection, None) |
| 752 |
|
p.scan_id = '456-789' |
| 753 |
|
p.kbdb.add_scan_preferences = MagicMock() |
| 754 |
|
p.prepare_alive_test_option_for_openvas() |
| 755 |
|
|
| 756 |
|
p.kbdb.add_scan_preferences.assert_not_called() |
| 757 |
|
|
| 758 |
|
@patch('ospd_openvas.db.KbDB') |
| 759 |
|
def test_set_alive_no_invalid_alive_test(self, mock_kb): |