Code Duplication    Length = 25-30 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 287-316 (lines=30) @@
284
        params = response.findall('vts/vt/params/param')
285
        self.assertEqual(2, len(params))
286
287
    def test_get_vts_vts_with_refs(self):
288
        self.daemon.add_vt(
289
            '1.2.3.4',
290
            'A vulnerability test',
291
            vt_params="a",
292
            custom="b",
293
            vt_refs="c",
294
        )
295
        fs = FakeStream()
296
297
        self.daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>', fs)
298
        response = fs.get_response()
299
300
        # The status of the response must be success (i.e. 200)
301
        self.assertEqual(response.get('status'), '200')
302
303
        # The response root element must have the correct name
304
        self.assertEqual(response.tag, 'get_vts_response')
305
306
        # The response must contain a 'vts' element
307
        self.assertIsNotNone(response.find('vts'))
308
309
        vt_params = response[0][0].findall('params')
310
        self.assertEqual(1, len(vt_params))
311
312
        custom = response[0][0].findall('custom')
313
        self.assertEqual(1, len(custom))
314
315
        refs = response.findall('vts/vt/refs/ref')
316
        self.assertEqual(2, len(refs))
317
318
    def test_get_vts_vts_with_dependencies(self):
319
        self.daemon.add_vt(
@@ 261-285 (lines=25) @@
258
259
        self.assertEqual(3, len(custom))
260
261
    def test_get_vts_vts_with_params(self):
262
        self.daemon.add_vt(
263
            '1.2.3.4', 'A vulnerability test', vt_params="a", custom="b"
264
        )
265
        fs = FakeStream()
266
267
        self.daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>', fs)
268
        response = fs.get_response()
269
270
        # The status of the response must be success (i.e. 200)
271
        self.assertEqual(response.get('status'), '200')
272
273
        # The response root element must have the correct name
274
        self.assertEqual(response.tag, 'get_vts_response')
275
        # The response must contain a 'scanner_params' element
276
        self.assertIsNotNone(response.find('vts'))
277
278
        vt_params = response[0][0].findall('params')
279
        self.assertEqual(1, len(vt_params))
280
281
        custom = response[0][0].findall('custom')
282
        self.assertEqual(1, len(custom))
283
284
        params = response.findall('vts/vt/params/param')
285
        self.assertEqual(2, len(params))
286
287
    def test_get_vts_vts_with_refs(self):
288
        self.daemon.add_vt(