Posts Tagged: testclient
-
How to Test Flask Endpoints That Require Authentication Without Hitting the Database
Flask auth endpoint testing without DB: Mock Flask-Login user_loader, pytest fixtures for test_client + fake user. Parallel-safe (500 tests/s), zero flakes/DB setup. Full app+tests code. Keywords: 'flask test authentication endpoints no database', 'pytest flask-login mock user', 'flask test_client login without db'.
-
Using pytest Fixtures with FastAPI TestClient for Database Transaction Rollbacks
FastAPI pytest fixtures TestClient database transaction rollbacks: Isolate tests, zero data pollution. SQLAlchemy async sessions, pytest-asyncio override dependency. 500+ tests/s clean state. Code examples, conftest.py fixture, session.begin()/rollback(). Keywords: 'fastapi pytest database testing', 'fastapi testclient fixtures rollback', 'pytest fastapi sqlalchemy transaction rollback', 'fastapi testing isolation', 'pytest fixtures testclient'.