Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Flask example and tests #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

greyli
Copy link
Member

@greyli greyli commented Jun 25, 2021

This is a basic example for Flask and some universal tests for all the examples. The app generally follows the design in #1, the only difference is that I remove the age field.

After it's merged, I will start to set up the repo (tox, pre-commit hook, CI, etc.).

Copy link
Contributor

@jugmac00 jugmac00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, thank you so much for putting so much effort into showcasing Flask's capabilities to provide web APIs.

A couple of remarks:

  • README.md is missing
  • requirements.txt is missing
  • it would be nice to have some curl commands for copy pasting at the top level README to play with the API

Additionally, I have left some inline comments.

Btw, what is the reason to not support PUT?

Could you please explain the indirect=True parameter for parametrize? I had a look at pytests docs, but I am still puzzled.
Disclaimer, I don't work a lot with REST API.

I used curl to query the API, and looks good from my side!

examples/flask/app.py Outdated Show resolved Hide resolved
examples/flask/app.py Show resolved Hide resolved
@greyli
Copy link
Member Author

greyli commented Jun 30, 2021

Thanks for the review, I just added the missing README.md and requirements.txt/in files, and moved error messages and category list to separate variables.

it would be nice to have some curl commands for copy pasting at the top level README to play with the API

Sure, I will add it later.

what is the reason to not support PUT?

The PUT for updating a resource will be duplicate most of the update_pet view, so I think only support PATCH is enough for an example application.

Could you please explain the indirect=True parameter for parameterized?

It will pass the items in the example list to the client fixture (via request.param), so we can iterate all the example applications for each test.

Copy link
Contributor

@jugmac00 jugmac00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more minor comments 👍

examples/flask/README.md Show resolved Hide resolved
examples/flask/README.md Show resolved Hide resolved
examples/flask/app.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants