Test your pytest-flask knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/5Score 0
Why is testing an application via its HTTP test client (as pytest-flask facilitates) valuable, compared to only unit-testing individual functions in isolation?
Questions in this quiz
Why is testing an application via its HTTP test client (as pytest-flask facilitates) valuable, compared to only unit-testing individual functions in isolation?
Why might a Flask test verify not just a successful (200) response but also how the application handles an invalid request (like malformed JSON or a missing required field)?
Why might CI (continuous integration) commonly run the full pytest-flask test suite automatically on every pull request?
Why might testing response headers (like Content-Type or a custom API header) be a meaningful part of a pytest-flask test, not just the response body?
Why might a pytest-flask test verify a redirect response (like after a successful form submission) by checking both the status code and the `Location` header, rather than only following the redirect automatically?
How does pytest-flask typically discover the Flask application instance to test against?
What is the general benefit of pytest-flask reducing per-test boilerplate (like manually creating a test client each time) compared to writing that setup code repeatedly in every test file?
What is a reasonable practice for resetting database state between individual tests in a pytest-flask suite that creates/modifies data during tests?
How might a pytest-flask test verify that a route correctly requires authentication, rejecting an unauthenticated request?
What is a general reason integration-style tests (via pytest-flask's test client) and lower-level unit tests (testing individual functions in isolation) are often used together in a Flask project, rather than relying on just one type?
Why might a pytest-flask test suite mock or stub an external API call (rather than making a real network request) when testing a Flask route that depends on that external service?
What is a common way a pytest-flask test verifies the outcome of a simulated request?