Code Duplication    Length = 16-21 lines in 2 locations

tests/testScanAndResult.py 2 locations

@@ 247-267 (lines=21) @@
244
        params = response.findall('vts/vt/vt_params/vt_param')
245
        self.assertEqual(2, len(params))
246
247
    def testGetVTs_VTs_with_refs(self):
248
        daemon = DummyWrapper([])
249
        daemon.add_vt('1.2.3.4',
250
                      'A vulnerability test',
251
                      vt_params="a",
252
                      custom="b",
253
                      vt_refs="c")
254
        response = secET.fromstring(
255
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>'))
256
        # The status of the response must be success (i.e. 200)
257
        self.assertEqual(response.get('status'), '200')
258
        # The response root element must have the correct name
259
        self.assertEqual(response.tag, 'get_vts_response')
260
        # The response must contain a 'vts' element
261
        self.assertIsNotNone(response.find('vts'))
262
        vt_params = response[0][0].findall('vt_params')
263
        self.assertEqual(1, len(vt_params))
264
        custom = response[0][0].findall('custom')
265
        self.assertEqual(1, len(custom))
266
        refs = response.findall('vts/vt/vt_refs/ref')
267
        self.assertEqual(2, len(refs))
268
269
    def testGetVTs_VTs_with_dependencies(self):
270
        daemon = DummyWrapper([])
@@ 228-243 (lines=16) @@
225
        custom = response.findall('vts/vt/custom')
226
        self.assertEqual(3, len(custom))
227
228
    def testGetVTs_VTs_with_params(self):
229
        daemon = DummyWrapper([])
230
        daemon.add_vt('1.2.3.4', 'A vulnerability test',
231
                      vt_params="a", custom="b")
232
        response = secET.fromstring(
233
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>'))
234
        # The status of the response must be success (i.e. 200)
235
        self.assertEqual(response.get('status'), '200')
236
        # The response root element must have the correct name
237
        self.assertEqual(response.tag, 'get_vts_response')
238
        # The response must contain a 'scanner_params' element
239
        self.assertIsNotNone(response.find('vts'))
240
        vt_params = response[0][0].findall('vt_params')
241
        self.assertEqual(1, len(vt_params))
242
        custom = response[0][0].findall('custom')
243
        self.assertEqual(1, len(custom))
244
        params = response.findall('vts/vt/vt_params/vt_param')
245
        self.assertEqual(2, len(params))
246