Code Duplication    Length = 36-36 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 653-688 (lines=36) @@
650
651
        self.assertEqual(response.findtext('scan/results/result'), None)
652
653
    def test_get_scan_pop_max_res(self):
654
        daemon = DummyWrapper(
655
            [
656
                Result('host-detail', value='Some Host Detail'),
657
                Result('host-detail', value='Some Host Detail1'),
658
                Result('host-detail', value='Some Host Detail2'),
659
            ]
660
        )
661
        fs = FakeStream()
662
        daemon.handle_command(
663
            '<start_scan target="localhost" ports="80, 443">'
664
            '<scanner_params /></start_scan>',
665
            fs,
666
        )
667
        response = fs.get_response()
668
669
        scan_id = response.findtext('id')
670
        time.sleep(1)
671
672
        fs = FakeStream()
673
        daemon.handle_command(
674
            '<get_scans scan_id="%s" pop_results="1" max_results="1"/>'
675
            % scan_id,
676
            fs,
677
        )
678
        response = fs.get_response()
679
680
        self.assertEqual(len(response.findall('scan/results/result')), 1)
681
682
        fs = FakeStream()
683
        daemon.handle_command(
684
            '<get_scans scan_id="%s" pop_results="1"/>' % scan_id, fs
685
        )
686
        response = fs.get_response()
687
688
        self.assertEqual(len(response.findall('scan/results/result')), 2)
689
690
    def test_billon_laughs(self):
691
        # pylint: disable=line-too-long
@@ 616-651 (lines=36) @@
613
614
        self.assertEqual(response.get('status'), '200')
615
616
    def test_get_scan_pop(self):
617
        daemon = DummyWrapper([Result('host-detail', value='Some Host Detail')])
618
        fs = FakeStream()
619
620
        daemon.handle_command(
621
            '<start_scan target="localhost" ports="80, 443">'
622
            '<scanner_params /></start_scan>',
623
            fs,
624
        )
625
        response = fs.get_response()
626
627
        scan_id = response.findtext('id')
628
        time.sleep(1)
629
630
        fs = FakeStream()
631
        daemon.handle_command('<get_scans scan_id="%s"/>' % scan_id, fs)
632
        response = fs.get_response()
633
634
        self.assertEqual(
635
            response.findtext('scan/results/result'), 'Some Host Detail'
636
        )
637
        fs = FakeStream()
638
        daemon.handle_command(
639
            '<get_scans scan_id="%s" pop_results="1"/>' % scan_id, fs
640
        )
641
        response = fs.get_response()
642
643
        self.assertEqual(
644
            response.findtext('scan/results/result'), 'Some Host Detail'
645
        )
646
647
        fs = FakeStream()
648
        daemon.handle_command('<get_scans details="0" pop_results="1"/>', fs)
649
        response = fs.get_response()
650
651
        self.assertEqual(response.findtext('scan/results/result'), None)
652
653
    def test_get_scan_pop_max_res(self):
654
        daemon = DummyWrapper(