Code Duplication    Length = 25-30 lines in 2 locations

tests/test_scan_and_result.py 2 locations

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