Code Duplication    Length = 20-24 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 408-431 (lines=24) @@
405
        params = response.findall('vts/vt/params/param')
406
        self.assertEqual(2, len(params))
407
408
    def test_get_vts_vts_with_refs(self):
409
        daemon = DummyWrapper([])
410
        daemon.add_vt(
411
            '1.2.3.4',
412
            'A vulnerability test',
413
            vt_params="a",
414
            custom="b",
415
            vt_refs="c",
416
        )
417
418
        response = secET.fromstring(
419
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')
420
        )
421
        # The status of the response must be success (i.e. 200)
422
        self.assertEqual(response.get('status'), '200')
423
424
        # The response root element must have the correct name
425
        self.assertEqual(response.tag, 'get_vts_response')
426
427
        # The response must contain a 'vts' element
428
        self.assertIsNotNone(response.find('vts'))
429
430
        vt_params = response[0][0].findall('params')
431
        self.assertEqual(1, len(vt_params))
432
433
        custom = response[0][0].findall('custom')
434
        self.assertEqual(1, len(custom))
@@ 382-401 (lines=20) @@
379
380
        self.assertEqual(3, len(custom))
381
382
    def test_get_vts_vts_with_params(self):
383
        daemon = DummyWrapper([])
384
        daemon.add_vt(
385
            '1.2.3.4', 'A vulnerability test', vt_params="a", custom="b"
386
        )
387
388
        response = secET.fromstring(
389
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')
390
        )
391
        # The status of the response must be success (i.e. 200)
392
        self.assertEqual(response.get('status'), '200')
393
394
        # The response root element must have the correct name
395
        self.assertEqual(response.tag, 'get_vts_response')
396
        # The response must contain a 'scanner_params' element
397
        self.assertIsNotNone(response.find('vts'))
398
399
        vt_params = response[0][0].findall('params')
400
        self.assertEqual(1, len(vt_params))
401
402
        custom = response[0][0].findall('custom')
403
        self.assertEqual(1, len(custom))
404