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