Code Duplication    Length = 25-30 lines in 2 locations

tests/test_scan_and_result.py 2 locations

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