From 394451e43efbf16f1a027c1b2a632b2aa3ffe1a0 Mon Sep 17 00:00:00 2001 From: Juan Jose Nicola Date: Thu, 11 Oct 2018 08:33:42 -0400 Subject: [PATCH] Improve unittest. In testGetScanPop() wait for the scan to end and then delete the scan. --- tests/testScanAndResult.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/testScanAndResult.py b/tests/testScanAndResult.py index 40124fdb..ede1b842 100644 --- a/tests/testScanAndResult.py +++ b/tests/testScanAndResult.py @@ -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( + '' % 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('' % scan_id)) self.assertEqual(response.get('status'), '200')