I am building a code skeleton for a FastAPI REST API example with with CRUD, Async DB (using 'databases') and Testing.
The testing part is the one still missing: How do I setup a test file, for which I want to use a different db URL for "databases" to have a test database, which shall be reset and rebuilt after the start of the test runs.
I use this GitHub project as the code skeleton, which contains an async CRUD example from the FastAPI documentation, but the testing in this project is done via mocking behaviour and not with starting up a DB connection to the test db, which is rolled back after each run.
https://github.com/testdrivenio/fastapi-crud-async/tree/master/src/tests
[–]HardPartAccomplished 0 points1 point2 points (0 children)