Code Duplication    Length = 22-25 lines in 2 locations

tests/command/test_commands.py 2 locations

@@ 180-204 (lines=25) @@
177
        with self.assertRaises(OspdError):
178
            cmd.handle_xml(request)
179
180
    @patch("ospd.command.command.create_process")
181
    def test_scan_with_vts_and_param(self, mock_create_process):
182
        daemon = DummyWrapper([])
183
        cmd = StartScan(daemon)
184
185
        # No error
186
        request = et.fromstring(
187
            '<start_scan>'
188
            '<targets>'
189
            '<target>'
190
            '<hosts>localhost</hosts>'
191
            '<ports>80, 443</ports>'
192
            '</target>'
193
            '</targets>'
194
            '<scanner_params />'
195
            '<vt_selection>'
196
            '<vt_single id="1234">'
197
            '<vt_value id="ABC">200</vt_value>'
198
            '</vt_single>'
199
            '</vt_selection>'
200
            '</start_scan>'
201
        )
202
        response = et.fromstring(cmd.handle_xml(request))
203
        scan_id = response.findtext('id')
204
205
        self.assertEqual(
206
            daemon.get_scan_vts(scan_id),
207
            {'1234': {'ABC': '200'}, 'vt_groups': []},
@@ 233-254 (lines=22) @@
230
        with self.assertRaises(OspdError):
231
            cmd.handle_xml(request)
232
233
    @patch("ospd.command.command.create_process")
234
    def test_scan_with_vts_and_param_with_vt_group_filter(
235
        self, mock_create_process
236
    ):
237
        daemon = DummyWrapper([])
238
        cmd = StartScan(daemon)
239
240
        # No error
241
        request = et.fromstring(
242
            '<start_scan>'
243
            '<targets>'
244
            '<target>'
245
            '<hosts>localhost</hosts>'
246
            '<ports>80, 443</ports>'
247
            '</target>'
248
            '</targets>'
249
            '<scanner_params />'
250
            '<vt_selection>'
251
            '<vt_group filter="a"/>'
252
            '</vt_selection>'
253
            '</start_scan>'
254
        )
255
        response = et.fromstring(cmd.handle_xml(request))
256
        scan_id = response.findtext('id')
257