When testing the FastAPI application with two different async sessions to the database, the following error may occur:

In the test, an object is created in the database (the test session).
A request is made to the application itself in which this object is changed (the application session).
An object is loaded from the database in the test, but there are no required changes in it (the test session).

Let’s find out what’s going on.

Leave a Reply

Your email address will not be published. Required fields are marked *