Complete the code to create a Flask test client instance.
from flask import Flask app = Flask(__name__) test_client = app.[1]()
The test_client() method creates a test client instance for the Flask app.
Complete the code to send a GET request to '/' using the Flask test client.
response = test_client.[1]('/')
The get method sends a GET request to the specified URL.
Fix the error in accessing the response data as text.
data = response.[1]The text attribute contains the response body as a string.
Fill both blanks to send a POST request with JSON data using the test client.
response = test_client.[1]('/submit', json=[2])
Use post method to send POST requests and pass JSON data as a dictionary.
Fill all three blanks to check the response status code and content type.
assert response.status_code == [1] assert response.headers['Content-Type'] == '[2]' assert 'text/html' in response.headers.get('[3]', '')
Status code 200 means success. The Content-Type header shows the response format. Checking header keys is case-sensitive.
