Tutorial by Examples

Introduction In this minimalist example, using pytest we're going to test that indeed our Hello World app does return "Hello, World!" with an HTTP OK status code of 200, when hit with a GET request on the URL / First let's install pytest into our virtualenv pip install pytest And jus...
This example assumes you know how to test a Flask app using pytest Below is an API that takes a JSON input with integer values a and b e.g. {"a": 1, "b": 2}, adds them up and returns sum a + b in a JSON response e.g. {"sum": 3}. # hello_add.py from flask import Flask...
Most of the web applications use the session object to store some important information. This examples show how you can test such application using Flask-Testing. Full working example is also available on github. So first install Flask-Testing in your virtualenv pip install flask_testing To be ...

Page 1 of 1