Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gtmanfred committed Oct 26, 2023
1 parent 90bf0cf commit 7ae9541
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flask_rebar/swagger_generation/swagger_generator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def get_todos_by_type(type_):
flask_converter="todo_type",
swagger_type=TodoTypeConverter,
)
With the above example, when something is labeled as a ``todo_type`` in
a path. The correct swagger can be returned.
"""
Expand Down
20 changes: 18 additions & 2 deletions tests/examples/test_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,30 @@ def test_crud(self):
headers={"X-MyApp-Key": "my-api-key", "Content-Type": "application/json"},
)
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.json["data"][0], {"id": 1, "complete": True, "description": "Find product market fit", "type": "user"})
self.assertEqual(
resp.json["data"][0],
{
"id": 1,
"complete": True,
"description": "Find product market fit",
"type": "user",
},
)

resp = self.app.test_client().get(
"/todos/user",
headers={"X-MyApp-Key": "my-api-key", "Content-Type": "application/json"},
)
self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.json["data"][0], {"id": 1, "complete": True, "description": "Find product market fit", "type": "user"})
self.assertEqual(
resp.json["data"][0],
{
"id": 1,
"complete": True,
"description": "Find product market fit",
"type": "user",
},
)

resp = self.app.test_client().get(
"/todos/group",
Expand Down
14 changes: 8 additions & 6 deletions tests/swagger_generation/registries/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@


class UUIDPathConverter:

@staticmethod
def to_swagger():
return {
sw.type_: sw.string,
sw.format_: sw.uuid
}
return {sw.type_: sw.string, sw.format_: sw.uuid}


swagger_v2_generator = SwaggerV2Generator()
Expand Down Expand Up @@ -124,7 +120,13 @@ def tagged_foos():
"paths": {
"/foos/{foo_uid}": {
"parameters": [
{"name": "foo_uid", "in": "path", "required": True, "type": "string", "format": "uuid"}
{
"name": "foo_uid",
"in": "path",
"required": True,
"type": "string",
"format": "uuid",
}
],
"get": {
"operationId": "get_foo",
Expand Down

0 comments on commit 7ae9541

Please sign in to comment.