Code Duplication    Length = 26-31 lines in 2 locations

tests/test_scan_and_result.py 2 locations

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