Code Duplication    Length = 26-31 lines in 2 locations

tests/test_scan_and_result.py 2 locations

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