|
@@ 757-785 (lines=29) @@
|
| 754 |
|
) |
| 755 |
|
self.assertEqual(res_len, 0) |
| 756 |
|
|
| 757 |
|
def test_get_scan_results_restore(self): |
| 758 |
|
fs = FakeStream() |
| 759 |
|
self.daemon.handle_command( |
| 760 |
|
'<start_scan target="localhost" ports="80, 443">' |
| 761 |
|
'<scanner_params /></start_scan>', |
| 762 |
|
fs, |
| 763 |
|
) |
| 764 |
|
self.daemon.start_queued_scans() |
| 765 |
|
response = fs.get_response() |
| 766 |
|
scan_id = response.findtext('id') |
| 767 |
|
|
| 768 |
|
self.daemon.add_scan_log(scan_id, host='a', name='a') |
| 769 |
|
self.daemon.add_scan_log(scan_id, host='c', name='c') |
| 770 |
|
self.daemon.add_scan_log(scan_id, host='b', name='b') |
| 771 |
|
|
| 772 |
|
fs = FakeStream(return_value=False) |
| 773 |
|
self.daemon.handle_command( |
| 774 |
|
'<get_scans scan_id="%s" pop_results="1"/>' % scan_id, fs, |
| 775 |
|
) |
| 776 |
|
|
| 777 |
|
res_len = len( |
| 778 |
|
self.daemon.scan_collection.scans_table[scan_id]['results'] |
| 779 |
|
) |
| 780 |
|
self.assertEqual(res_len, 3) |
| 781 |
|
|
| 782 |
|
res_len = len( |
| 783 |
|
self.daemon.scan_collection.scans_table[scan_id]['temp_results'] |
| 784 |
|
) |
| 785 |
|
self.assertEqual(res_len, 0) |
| 786 |
|
|
| 787 |
|
def test_billon_laughs(self): |
| 788 |
|
# pylint: disable=line-too-long |
|
@@ 727-755 (lines=29) @@
|
| 724 |
|
response = fs.get_response() |
| 725 |
|
self.assertEqual(len(response.findall('scan/results/result')), 2) |
| 726 |
|
|
| 727 |
|
def test_get_scan_results_clean(self): |
| 728 |
|
fs = FakeStream() |
| 729 |
|
self.daemon.handle_command( |
| 730 |
|
'<start_scan target="localhost" ports="80, 443">' |
| 731 |
|
'<scanner_params /></start_scan>', |
| 732 |
|
fs, |
| 733 |
|
) |
| 734 |
|
self.daemon.start_queued_scans() |
| 735 |
|
response = fs.get_response() |
| 736 |
|
scan_id = response.findtext('id') |
| 737 |
|
|
| 738 |
|
self.daemon.add_scan_log(scan_id, host='a', name='a') |
| 739 |
|
self.daemon.add_scan_log(scan_id, host='c', name='c') |
| 740 |
|
self.daemon.add_scan_log(scan_id, host='b', name='b') |
| 741 |
|
|
| 742 |
|
fs = FakeStream() |
| 743 |
|
self.daemon.handle_command( |
| 744 |
|
'<get_scans scan_id="%s" pop_results="1"/>' % scan_id, fs, |
| 745 |
|
) |
| 746 |
|
|
| 747 |
|
res_len = len( |
| 748 |
|
self.daemon.scan_collection.scans_table[scan_id]['results'] |
| 749 |
|
) |
| 750 |
|
self.assertEqual(res_len, 0) |
| 751 |
|
|
| 752 |
|
res_len = len( |
| 753 |
|
self.daemon.scan_collection.scans_table[scan_id]['temp_results'] |
| 754 |
|
) |
| 755 |
|
self.assertEqual(res_len, 0) |
| 756 |
|
|
| 757 |
|
def test_get_scan_results_restore(self): |
| 758 |
|
fs = FakeStream() |