Code Duplication    Length = 20-24 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 367-390 (lines=24) @@
364
        params = response.findall('vts/vt/params/param')
365
        self.assertEqual(2, len(params))
366
367
    def test_get_vts_vts_with_refs(self):
368
        daemon = DummyWrapper([])
369
        daemon.add_vt(
370
            '1.2.3.4',
371
            'A vulnerability test',
372
            vt_params="a",
373
            custom="b",
374
            vt_refs="c",
375
        )
376
377
        response = secET.fromstring(
378
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')
379
        )
380
        # The status of the response must be success (i.e. 200)
381
        self.assertEqual(response.get('status'), '200')
382
383
        # The response root element must have the correct name
384
        self.assertEqual(response.tag, 'get_vts_response')
385
386
        # The response must contain a 'vts' element
387
        self.assertIsNotNone(response.find('vts'))
388
389
        vt_params = response[0][0].findall('params')
390
        self.assertEqual(1, len(vt_params))
391
392
        custom = response[0][0].findall('custom')
393
        self.assertEqual(1, len(custom))
@@ 341-360 (lines=20) @@
338
339
        self.assertEqual(3, len(custom))
340
341
    def test_get_vts_vts_with_params(self):
342
        daemon = DummyWrapper([])
343
        daemon.add_vt(
344
            '1.2.3.4', 'A vulnerability test', vt_params="a", custom="b"
345
        )
346
347
        response = secET.fromstring(
348
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')
349
        )
350
        # The status of the response must be success (i.e. 200)
351
        self.assertEqual(response.get('status'), '200')
352
353
        # The response root element must have the correct name
354
        self.assertEqual(response.tag, 'get_vts_response')
355
        # The response must contain a 'scanner_params' element
356
        self.assertIsNotNone(response.find('vts'))
357
358
        vt_params = response[0][0].findall('params')
359
        self.assertEqual(1, len(vt_params))
360
361
        custom = response[0][0].findall('custom')
362
        self.assertEqual(1, len(custom))
363