|
3 | 3 | import unittest |
4 | 4 | from importlib.metadata import version |
5 | 5 | from pathlib import Path |
6 | | -from typing import Any, Optional, Tuple, Union |
| 6 | +from typing import Optional |
7 | 7 | from unittest import mock |
8 | 8 |
|
9 | 9 | from click.testing import CliRunner |
10 | | -from pydantic import BaseModel, Field |
| 10 | +from pydantic import Field |
11 | 11 | from typing_extensions import Annotated |
12 | 12 |
|
13 | 13 | from defectdojo_api_generated.api.findings_api import FindingsApi |
@@ -287,40 +287,6 @@ def test_required_request_body_parameters_become_field_flags(self): |
287 | 287 | payload = json.loads(run_result.output) |
288 | 288 | self.assertEqual(payload['name'], 'Example') |
289 | 289 |
|
290 | | - def test_request_model_fields_typed_as_any_register_without_import_errors(self): |
291 | | - class AnyRequest(BaseModel): |
292 | | - payload: Any = None |
293 | | - |
294 | | - class AnyRequestApi: |
295 | | - def __init__(self, api_client): |
296 | | - self.api_client = api_client |
297 | | - |
298 | | - def create(self, any_request: AnyRequest): |
299 | | - return any_request.model_dump() |
300 | | - |
301 | | - command = make_api_group('any_request_api', AnyRequestApi).click |
302 | | - option = next(param for param in command.params if getattr(param, 'name', None) == 'payload') |
303 | | - |
304 | | - self.assertEqual(option.type.name, 'text') |
305 | | - |
306 | | - def test_request_model_file_fields_annotate_as_path(self): |
307 | | - class FileRequest(BaseModel): |
308 | | - file: Optional[Union[bytes, str, Tuple[str, bytes]]] = None |
309 | | - |
310 | | - class FileRequestApi: |
311 | | - def __init__(self, api_client): |
312 | | - self.api_client = api_client |
313 | | - |
314 | | - def create(self, file_request: FileRequest): |
315 | | - return file_request.model_dump() |
316 | | - |
317 | | - command_class = make_api_group('file_request_api', FileRequestApi) |
318 | | - command = command_class.click |
319 | | - option = next(param for param in command.params if getattr(param, 'name', None) == 'file') |
320 | | - |
321 | | - self.assertIs(command_class.__annotations__['file'], Path) |
322 | | - self.assertEqual(option.type.name, 'file') |
323 | | - |
324 | 290 | def test_bad_request_exception_uses_detail_message(self): |
325 | 291 | runner = CliRunner() |
326 | 292 |
|
|
0 commit comments