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

Commit

Permalink
Improve unittest.
Browse files Browse the repository at this point in the history
In testGetScanPop() wait for the scan to end and then delete the scan.
  • Loading branch information
jjnicola committed Oct 11, 2018
1 parent eae6a74 commit 394451e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/testScanAndResult.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,16 @@ def testGetScanPop(self):
self.assertEqual(response.findtext('scan/results/result'),
None)

time.sleep(1)
while True:
response = secET.fromstring(
daemon.handle_command(
'<get_scans scan_id="%s" details="0"/>' % scan_id))
scans = response.findall('scan')
self.assertEqual(1, len(scans))
scan = scans[0]
if int(scan.get('progress')) == 100:
break

response = secET.fromstring(
daemon.handle_command('<delete_scan scan_id="%s" />' % scan_id))
self.assertEqual(response.get('status'), '200')
Expand Down

0 comments on commit 394451e

Please sign in to comment.