Code Duplication    Length = 24-29 lines in 2 locations

tests/command/test_commands.py 2 locations

@@ 310-338 (lines=29) @@
307
        with self.assertRaises(OspdError):
308
            cmd.handle_xml(request)
309
310
    @patch("ospd.ospd.create_process")
311
    def test_scan_with_vts_and_param_with_vt_group_filter(
312
        self, mock_create_process
313
    ):
314
        daemon = DummyWrapper([])
315
        cmd = StartScan(daemon)
316
317
        # No error
318
        request = et.fromstring(
319
            '<start_scan>'
320
            '<targets>'
321
            '<target>'
322
            '<hosts>localhost</hosts>'
323
            '<ports>80, 443</ports>'
324
            '</target>'
325
            '</targets>'
326
            '<scanner_params />'
327
            '<vt_selection>'
328
            '<vt_group filter="a"/>'
329
            '</vt_selection>'
330
            '</start_scan>'
331
        )
332
        response = et.fromstring(cmd.handle_xml(request))
333
        scan_id = response.findtext('id')
334
335
        self.assertEqual(daemon.get_scan_vts(scan_id), {'vt_groups': ['a']})
336
337
        daemon.start_pending_scans()
338
        assert_called(mock_create_process)
339
340
    @patch("ospd.ospd.create_process")
341
    @patch("ospd.command.command.logger")
@@ 209-232 (lines=24) @@
206
207
        self.assertTrue(cmd.is_new_scan_allowed())
208
209
    @patch("ospd.ospd.create_process")
210
    def test_scan_without_vts(self, mock_create_process):
211
        daemon = DummyWrapper([])
212
        cmd = StartScan(daemon)
213
214
        # With out vts
215
        request = et.fromstring(
216
            '<start_scan>'
217
            '<targets>'
218
            '<target>'
219
            '<hosts>localhost</hosts>'
220
            '<ports>80, 443</ports>'
221
            '</target>'
222
            '</targets>'
223
            '<scanner_params />'
224
            '</start_scan>'
225
        )
226
        response = et.fromstring(cmd.handle_xml(request))
227
228
        scan_id = response.findtext('id')
229
        self.assertEqual(daemon.get_scan_vts(scan_id), {})
230
231
        daemon.start_pending_scans()
232
        assert_called(mock_create_process)
233
234
    def test_scan_with_vts_and_param_missing_vt_param_id(self):
235
        daemon = DummyWrapper([])