Discrepancies Between Test and FastAPI App Data

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

  1. In the test, an object is created in the database (the test session).
  2. A request is made to the application itself in which this object is changed (the application session).
  3. 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.

CategoriesUncategorized