Complete the code to import the pytest module.
import [1]
We import pytest to use its testing features including fixtures.
Complete the code to define a pytest fixture that creates a Flask app instance.
@pytest.fixture def app(): app = Flask(__name__) app.config['TESTING'] = [1] return app
Setting TESTING to True enables testing mode in Flask.
Fix the error in the test function to use the fixture correctly.
def test_home([1]): response = app.test_client().get('/') assert response.status_code == 200
The fixture named app must be passed as a parameter to the test function.
Fill both blanks to create a fixture that provides a test client from the Flask app fixture.
@pytest.fixture def client([1]): return [2].test_client()
The client fixture depends on the app fixture and returns its test client.
Fill all three blanks to write a test using the client fixture to check the home page response.
def test_home_page([1]): response = [2].get('/') assert response.[3] == 200
The test function uses the client fixture to send a GET request and checks the status_code.
