Skip to content

Commit

Permalink
fix formatting according to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
austinpgraham committed Dec 26, 2023
1 parent d93d2c7 commit bd001f3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
42 changes: 23 additions & 19 deletions ninja/openapi/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,23 @@ def __init__(self, api: "NinjaAPI", path_prefix: str) -> None:
self.securitySchemes: DictStrAny = {}
self.all_operation_ids: Set = set()
extra_info = api.openapi_extra.get("info", {})
super().__init__([
("openapi", "3.1.0"),
(
"info",
{
"title": api.title,
"version": api.version,
"description": api.description,
**extra_info,
},
),
("paths", self.get_paths()),
("components", self.get_components()),
("servers", api.servers),
])
super().__init__(
[
("openapi", "3.1.0"),
(
"info",
{
"title": api.title,
"version": api.version,
"description": api.description,
**extra_info,
},
),
("paths", self.get_paths()),
("components", self.get_components()),
("servers", api.servers),
]
)
for k, v in api.openapi_extra.items():
if k not in self:
self[k] = v
Expand Down Expand Up @@ -235,10 +237,12 @@ def _create_multipart_schema_from_models(
content_type = BODY_CONTENT_TYPES["file"]

# get the various schemas
result = merge_schemas([
self._create_schema_from_model(model, remove_level=False)[0]
for model in models
])
result = merge_schemas(
[
self._create_schema_from_model(model, remove_level=False)[0]
for model in models
]
)
result["title"] = "MultiPartBodyParams"

return result, content_type
Expand Down
10 changes: 6 additions & 4 deletions ninja/testing/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,12 @@ def _build_request(
request.META = request_params.pop("META", {})
request.FILES = request_params.pop("FILES", {})

request.META.update({
f"HTTP_{k.replace('-', '_')}": v
for k, v in request_params.pop("headers", {}).items()
})
request.META.update(
{
f"HTTP_{k.replace('-', '_')}": v
for k, v in request_params.pop("headers", {}).items()
}
)

request.headers = HttpHeaders(request.META)

Expand Down

0 comments on commit bd001f3

Please sign in to comment.