Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
Add test to check preservation of result's order.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnicola committed Jul 24, 2019
1 parent e954375 commit df9fd73
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_scan_and_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,3 +1095,33 @@ def test_resume_task(self):
)
result = response.findall('scan/results/result')
self.assertEqual(len(result), 2)

def test_result_order (self):
daemon = DummyWrapper([])
response = secET.fromstring(
daemon.handle_command(
'<start_scan parallel="1">'
'<scanner_params />'
'<targets><target>'
'<hosts>a</hosts>'
'<ports>22</ports>'
'</target></targets>'
'</start_scan>'
)
)

scan_id = response.findtext('id')

daemon.add_scan_log(scan_id, host='a', name='a')
daemon.add_scan_log(scan_id, host='c', name='c')
daemon.add_scan_log(scan_id, host='b', name='b')
hosts = ['a','c','b']
response = secET.fromstring(
daemon.handle_command('<get_scans details="1"/>'
)
)
results = response.findall("scan/results/")

for idx, res in enumerate(results):
att_dict = res.attrib
self.assertEqual(hosts[idx], att_dict['name'])

0 comments on commit df9fd73

Please sign in to comment.