Code Duplication    Length = 26-31 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 255-285 (lines=31) @@
252
        params = response.findall('vts/vt/params/param')
253
        self.assertEqual(2, len(params))
254
255
    def test_get_vts_vts_with_refs(self):
256
        daemon = DummyWrapper([])
257
        daemon.add_vt(
258
            '1.2.3.4',
259
            'A vulnerability test',
260
            vt_params="a",
261
            custom="b",
262
            vt_refs="c",
263
        )
264
        fs = FakeStream()
265
266
        daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>', fs)
267
        response = fs.get_response()
268
269
        # The status of the response must be success (i.e. 200)
270
        self.assertEqual(response.get('status'), '200')
271
272
        # The response root element must have the correct name
273
        self.assertEqual(response.tag, 'get_vts_response')
274
275
        # The response must contain a 'vts' element
276
        self.assertIsNotNone(response.find('vts'))
277
278
        vt_params = response[0][0].findall('params')
279
        self.assertEqual(1, len(vt_params))
280
281
        custom = response[0][0].findall('custom')
282
        self.assertEqual(1, len(custom))
283
284
        refs = response.findall('vts/vt/refs/ref')
285
        self.assertEqual(2, len(refs))
286
287
    def test_get_vts_vts_with_dependencies(self):
288
        daemon = DummyWrapper([])
@@ 228-253 (lines=26) @@
225
226
        self.assertEqual(3, len(custom))
227
228
    def test_get_vts_vts_with_params(self):
229
        daemon = DummyWrapper([])
230
        daemon.add_vt(
231
            '1.2.3.4', 'A vulnerability test', vt_params="a", custom="b"
232
        )
233
        fs = FakeStream()
234
235
        daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>', fs)
236
        response = fs.get_response()
237
238
        # The status of the response must be success (i.e. 200)
239
        self.assertEqual(response.get('status'), '200')
240
241
        # The response root element must have the correct name
242
        self.assertEqual(response.tag, 'get_vts_response')
243
        # The response must contain a 'scanner_params' element
244
        self.assertIsNotNone(response.find('vts'))
245
246
        vt_params = response[0][0].findall('params')
247
        self.assertEqual(1, len(vt_params))
248
249
        custom = response[0][0].findall('custom')
250
        self.assertEqual(1, len(custom))
251
252
        params = response.findall('vts/vt/params/param')
253
        self.assertEqual(2, len(params))
254
255
    def test_get_vts_vts_with_refs(self):
256
        daemon = DummyWrapper([])