| @@ 595-627 (lines=33) @@ | ||
| 592 | ) |
|
| 593 | self.assertEqual(response.findtext('scan/results/result'), None) |
|
| 594 | ||
| 595 | def test_get_scan_pop_max_res(self): |
|
| 596 | daemon = DummyWrapper( |
|
| 597 | [ |
|
| 598 | Result('host-detail', value='Some Host Detail'), |
|
| 599 | Result('host-detail', value='Some Host Detail1'), |
|
| 600 | Result('host-detail', value='Some Host Detail2'), |
|
| 601 | ] |
|
| 602 | ) |
|
| 603 | ||
| 604 | response = secET.fromstring( |
|
| 605 | daemon.handle_command( |
|
| 606 | '<start_scan target="localhost" ports="80, 443">' |
|
| 607 | '<scanner_params /></start_scan>' |
|
| 608 | ) |
|
| 609 | ) |
|
| 610 | ||
| 611 | scan_id = response.findtext('id') |
|
| 612 | time.sleep(1) |
|
| 613 | ||
| 614 | response = secET.fromstring( |
|
| 615 | daemon.handle_command( |
|
| 616 | '<get_scans scan_id="%s" pop_results="1" max_results="1"/>' |
|
| 617 | % scan_id |
|
| 618 | ) |
|
| 619 | ) |
|
| 620 | self.assertEqual(len(response.findall('scan/results/result')), 1) |
|
| 621 | ||
| 622 | response = secET.fromstring( |
|
| 623 | daemon.handle_command( |
|
| 624 | '<get_scans scan_id="%s" pop_results="1"/>' % scan_id |
|
| 625 | ) |
|
| 626 | ) |
|
| 627 | self.assertEqual(len(response.findall('scan/results/result')), 2) |
|
| 628 | ||
| 629 | def test_billon_laughs(self): |
|
| 630 | # pylint: disable=line-too-long |
|
| @@ 561-593 (lines=33) @@ | ||
| 558 | ||
| 559 | self.assertEqual(response.get('status'), '200') |
|
| 560 | ||
| 561 | def test_get_scan_pop(self): |
|
| 562 | daemon = DummyWrapper([Result('host-detail', value='Some Host Detail')]) |
|
| 563 | ||
| 564 | response = secET.fromstring( |
|
| 565 | daemon.handle_command( |
|
| 566 | '<start_scan target="localhost" ports="80, 443">' |
|
| 567 | '<scanner_params /></start_scan>' |
|
| 568 | ) |
|
| 569 | ) |
|
| 570 | ||
| 571 | scan_id = response.findtext('id') |
|
| 572 | time.sleep(1) |
|
| 573 | ||
| 574 | response = secET.fromstring( |
|
| 575 | daemon.handle_command('<get_scans scan_id="%s"/>' % scan_id) |
|
| 576 | ) |
|
| 577 | self.assertEqual( |
|
| 578 | response.findtext('scan/results/result'), 'Some Host Detail' |
|
| 579 | ) |
|
| 580 | ||
| 581 | response = secET.fromstring( |
|
| 582 | daemon.handle_command( |
|
| 583 | '<get_scans scan_id="%s" pop_results="1"/>' % scan_id |
|
| 584 | ) |
|
| 585 | ) |
|
| 586 | self.assertEqual( |
|
| 587 | response.findtext('scan/results/result'), 'Some Host Detail' |
|
| 588 | ) |
|
| 589 | ||
| 590 | response = secET.fromstring( |
|
| 591 | daemon.handle_command('<get_scans details="0" pop_results="1"/>') |
|
| 592 | ) |
|
| 593 | self.assertEqual(response.findtext('scan/results/result'), None) |
|
| 594 | ||
| 595 | def test_get_scan_pop_max_res(self): |
|
| 596 | daemon = DummyWrapper( |
|