Code Duplication    Length = 36-36 lines in 2 locations

tests/test_scan_and_result.py 2 locations

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