| @@ 567-591 (lines=25) @@ | ||
| 564 | response = fs.get_response() |
|
| 565 | scan_id = response.findtext('id') |
|
| 566 | finished = False |
|
| 567 | while not finished: |
|
| 568 | fs = FakeStream() |
|
| 569 | daemon.handle_command( |
|
| 570 | '<get_scans scan_id="%s" details="1"/>' % scan_id, fs |
|
| 571 | ) |
|
| 572 | response = fs.get_response() |
|
| 573 | ||
| 574 | scans = response.findall('scan') |
|
| 575 | self.assertEqual(1, len(scans)) |
|
| 576 | ||
| 577 | scan = scans[0] |
|
| 578 | status = scan.get('status') |
|
| 579 | ||
| 580 | if status == "init" or status == "running": |
|
| 581 | self.assertEqual('0', scan.get('end_time')) |
|
| 582 | time.sleep(0.010) |
|
| 583 | else: |
|
| 584 | finished = True |
|
| 585 | ||
| 586 | fs = FakeStream() |
|
| 587 | ||
| 588 | daemon.handle_command( |
|
| 589 | '<get_scans scan_id="%s" details="1"/>' % scan_id, fs |
|
| 590 | ) |
|
| 591 | response = fs.get_response() |
|
| 592 | ||
| 593 | self.assertEqual( |
|
| 594 | response.findtext('scan/results/result'), 'something went wrong' |
|
| @@ 516-538 (lines=23) @@ | ||
| 513 | ||
| 514 | finished = False |
|
| 515 | ||
| 516 | while not finished: |
|
| 517 | fs = FakeStream() |
|
| 518 | daemon.handle_command( |
|
| 519 | '<get_scans scan_id="%s" details="1"/>' % scan_id, fs |
|
| 520 | ) |
|
| 521 | response = fs.get_response() |
|
| 522 | ||
| 523 | scans = response.findall('scan') |
|
| 524 | self.assertEqual(1, len(scans)) |
|
| 525 | ||
| 526 | scan = scans[0] |
|
| 527 | status = scan.get('status') |
|
| 528 | ||
| 529 | if scan.get('end_time') != '0': |
|
| 530 | finished = True |
|
| 531 | else: |
|
| 532 | time.sleep(0.01) |
|
| 533 | ||
| 534 | fs = FakeStream() |
|
| 535 | daemon.handle_command( |
|
| 536 | '<get_scans scan_id="%s" details="1"/>' % scan_id, fs |
|
| 537 | ) |
|
| 538 | response = fs.get_response() |
|
| 539 | ||
| 540 | self.assertEqual(len(list(daemon.scan_collection.ids_iterator())), 1) |
|
| 541 | ||