Code Duplication    Length = 22-25 lines in 2 locations

tests/command/test_commands.py 2 locations

@@ 148-172 (lines=25) @@
145
        with self.assertRaises(OspdCommandError):
146
            cmd.handle_xml(request)
147
148
    @patch("ospd.command.command.create_process")
149
    def test_scan_with_vts_and_param(self, mock_create_process):
150
        daemon = DummyWrapper([])
151
        cmd = StartScan(daemon)
152
153
        # No error
154
        request = et.fromstring(
155
            '<start_scan target="localhost" ports="80, 443">'
156
            '<scanner_params />'
157
            '<vt_selection>'
158
            '<vt_single id="1234">'
159
            '<vt_value id="ABC">200</vt_value>'
160
            '</vt_single>'
161
            '</vt_selection>'
162
            '</start_scan>'
163
        )
164
        response = et.fromstring(cmd.handle_xml(request))
165
        scan_id = response.findtext('id')
166
167
        self.assertEqual(
168
            daemon.get_scan_vts(scan_id),
169
            {'1234': {'ABC': '200'}, 'vt_groups': []},
170
        )
171
172
        assert_called(mock_create_process)
173
174
    def test_scan_with_vts_and_param_missing_vt_group_filter(self):
175
        daemon = DummyWrapper([])
@@ 189-210 (lines=22) @@
186
        with self.assertRaises(OspdCommandError):
187
            cmd.handle_xml(request)
188
189
    @patch("ospd.command.command.create_process")
190
    def test_scan_with_vts_and_param_with_vt_group_filter(
191
        self, mock_create_process
192
    ):
193
        daemon = DummyWrapper([])
194
        cmd = StartScan(daemon)
195
196
        # No error
197
        request = et.fromstring(
198
            '<start_scan target="localhost" ports="80, 443">'
199
            '<scanner_params />'
200
            '<vt_selection>'
201
            '<vt_group filter="a"/>'
202
            '</vt_selection>'
203
            '</start_scan>'
204
        )
205
        response = et.fromstring(cmd.handle_xml(request))
206
        scan_id = response.findtext('id')
207
208
        self.assertEqual(daemon.get_scan_vts(scan_id), {'vt_groups': ['a']})
209
210
        assert_called(mock_create_process)
211
212
    def test_scan_multi_target_parallel_with_error(self):
213
        daemon = DummyWrapper([])