Code Duplication    Length = 20-24 lines in 2 locations

tests/test_scan_and_result.py 2 locations

@@ 239-262 (lines=24) @@
236
        params = response.findall('vts/vt/params/param')
237
        self.assertEqual(2, len(params))
238
239
    def test_get_vts_vts_with_refs(self):
240
        daemon = DummyWrapper([])
241
        daemon.add_vt(
242
            '1.2.3.4',
243
            'A vulnerability test',
244
            vt_params="a",
245
            custom="b",
246
            vt_refs="c",
247
        )
248
249
        response = secET.fromstring(
250
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')
251
        )
252
        # The status of the response must be success (i.e. 200)
253
        self.assertEqual(response.get('status'), '200')
254
255
        # The response root element must have the correct name
256
        self.assertEqual(response.tag, 'get_vts_response')
257
258
        # The response must contain a 'vts' element
259
        self.assertIsNotNone(response.find('vts'))
260
261
        vt_params = response[0][0].findall('params')
262
        self.assertEqual(1, len(vt_params))
263
264
        custom = response[0][0].findall('custom')
265
        self.assertEqual(1, len(custom))
@@ 213-232 (lines=20) @@
210
211
        self.assertEqual(3, len(custom))
212
213
    def test_get_vts_vts_with_params(self):
214
        daemon = DummyWrapper([])
215
        daemon.add_vt(
216
            '1.2.3.4', 'A vulnerability test', vt_params="a", custom="b"
217
        )
218
219
        response = secET.fromstring(
220
            daemon.handle_command('<get_vts vt_id="1.2.3.4"></get_vts>')
221
        )
222
        # The status of the response must be success (i.e. 200)
223
        self.assertEqual(response.get('status'), '200')
224
225
        # The response root element must have the correct name
226
        self.assertEqual(response.tag, 'get_vts_response')
227
        # The response must contain a 'scanner_params' element
228
        self.assertIsNotNone(response.find('vts'))
229
230
        vt_params = response[0][0].findall('params')
231
        self.assertEqual(1, len(vt_params))
232
233
        custom = response[0][0].findall('custom')
234
        self.assertEqual(1, len(custom))
235