Testing POST request using Flask Test Client

Report a typo

In this problem, you will see how to write a test and use the Flask test client for sending POST requests. Write the function test_post_using_test_client which accepts three parameters app, url and payload,

  • app is a Flask app,
  • url is a URL exposed via the app
  • payload is the JSON request data to send a POST request to the URL.

Assert that the response is a success 201 CREATE success.

Write a program in Python 3
def test_post_using_test_client(flask_app, url, payload):
pass
___

Create a free account to access the full topic