Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola committed Apr 26, 2021
1 parent 5369e05 commit 8a4f2c5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_preferencehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ def test_set_ports(self, mock_kb):
['port_range|||80,443'],
)

@patch('ospd_openvas.db.KbDB')
def test_set_ports_invalid(self, mock_kb):
w = DummyDaemon()

w.scan_collection.get_ports = MagicMock(return_value='2,-9,4')

p = PreferenceHandler('1234-1234', mock_kb, w.scan_collection, None)
p.scan_id = '456-789'
p.kbdb.add_scan_preferences = MagicMock()
self.assertFalse(p.prepare_ports_for_openvas())

@patch('ospd_openvas.db.KbDB')
def test_set_main_kbindex(self, mock_kb):
w = DummyDaemon()
Expand Down

0 comments on commit 8a4f2c5

Please sign in to comment.