Code Duplication    Length = 25-30 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 323-352 (lines=30) @@
320
        params = response.findall('vts/vt/params/param')
321
        self.assertEqual(2, len(params))
322
323
    def test_get_vts_vts_with_refs(self):
324
        self.daemon.add_vt(
325
            '1.2.3.4',
326
            'A vulnerability test',
327
            vt_params="a",
328
            custom="b",
329
            vt_refs="c",
330
        )
331
        fs = FakeStream()
332
333
        self.daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>', fs)
334
        response = fs.get_response()
335
336
        # The status of the response must be success (i.e. 200)
337
        self.assertEqual(response.get('status'), '200')
338
339
        # The response root element must have the correct name
340
        self.assertEqual(response.tag, 'get_vts_response')
341
342
        # The response must contain a 'vts' element
343
        self.assertIsNotNone(response.find('vts'))
344
345
        vt_params = response[0][0].findall('params')
346
        self.assertEqual(1, len(vt_params))
347
348
        custom = response[0][0].findall('custom')
349
        self.assertEqual(1, len(custom))
350
351
        refs = response.findall('vts/vt/refs/ref')
352
        self.assertEqual(2, len(refs))
353
354
    def test_get_vts_vts_with_dependencies(self):
355
        self.daemon.add_vt(
@@ 297-321 (lines=25) @@
294
295
        self.assertEqual(3, len(custom))
296
297
    def test_get_vts_vts_with_params(self):
298
        self.daemon.add_vt(
299
            '1.2.3.4', 'A vulnerability test', vt_params="a", custom="b"
300
        )
301
        fs = FakeStream()
302
303
        self.daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>', fs)
304
        response = fs.get_response()
305
306
        # The status of the response must be success (i.e. 200)
307
        self.assertEqual(response.get('status'), '200')
308
309
        # The response root element must have the correct name
310
        self.assertEqual(response.tag, 'get_vts_response')
311
        # The response must contain a 'scanner_params' element
312
        self.assertIsNotNone(response.find('vts'))
313
314
        vt_params = response[0][0].findall('params')
315
        self.assertEqual(1, len(vt_params))
316
317
        custom = response[0][0].findall('custom')
318
        self.assertEqual(1, len(custom))
319
320
        params = response.findall('vts/vt/params/param')
321
        self.assertEqual(2, len(params))
322
323
    def test_get_vts_vts_with_refs(self):
324
        self.daemon.add_vt(