How to apply integration tests to a Flask RESTful API

Flask provides a test_client you can use in your tests:

from source.api import app
from unittest import TestCase

class TestIntegrations(TestCase):
    def setUp(self):
        self.app = app.test_client()

    def test_thing(self):
        response = self.app.get("https://stackoverflow.com/")
        assert <make your assertion here>

Flask Testing Docs

Leave a Comment

tech