Code Duplication    Length = 16-21 lines in 2 locations

tests/testScanAndResult.py 2 locations

@@ 282-302 (lines=21) @@
279
        params = response.findall('vts/vt/params/param')
280
        self.assertEqual(2, len(params))
281
282
    def testGetVTs_VTs_with_refs(self):
283
        daemon = DummyWrapper([])
284
        daemon.add_vt('1.2.3.4',
285
                      'A vulnerability test',
286
                      vt_params="a",
287
                      custom="b",
288
                      vt_refs="c")
289
        response = secET.fromstring(
290
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>'))
291
        # The status of the response must be success (i.e. 200)
292
        self.assertEqual(response.get('status'), '200')
293
        # The response root element must have the correct name
294
        self.assertEqual(response.tag, 'get_vts_response')
295
        # The response must contain a 'vts' element
296
        self.assertIsNotNone(response.find('vts'))
297
        vt_params = response[0][0].findall('params')
298
        self.assertEqual(1, len(vt_params))
299
        custom = response[0][0].findall('custom')
300
        self.assertEqual(1, len(custom))
301
        refs = response.findall('vts/vt/refs/ref')
302
        self.assertEqual(2, len(refs))
303
304
    def testGetVTs_VTs_with_dependencies(self):
305
        daemon = DummyWrapper([])
@@ 263-278 (lines=16) @@
260
        custom = response.findall('vts/vt/custom')
261
        self.assertEqual(3, len(custom))
262
263
    def testGetVTs_VTs_with_params(self):
264
        daemon = DummyWrapper([])
265
        daemon.add_vt('1.2.3.4', 'A vulnerability test',
266
                      vt_params="a", custom="b")
267
        response = secET.fromstring(
268
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>'))
269
        # The status of the response must be success (i.e. 200)
270
        self.assertEqual(response.get('status'), '200')
271
        # The response root element must have the correct name
272
        self.assertEqual(response.tag, 'get_vts_response')
273
        # The response must contain a 'scanner_params' element
274
        self.assertIsNotNone(response.find('vts'))
275
        vt_params = response[0][0].findall('params')
276
        self.assertEqual(1, len(vt_params))
277
        custom = response[0][0].findall('custom')
278
        self.assertEqual(1, len(custom))
279
        params = response.findall('vts/vt/params/param')
280
        self.assertEqual(2, len(params))
281