Testing Protected Routes

Tests for an API's rules about who may do what sign in inside a fixture and send the token in the Authorization header, try each rule as each kind of user and once with no token, and can override get_current_user with dependency_overrides as a shortcut, knowing it skips the token check.

By

Updated

Cheat sheet: Testing Protected Routes
Category
FastAPI
Level
Journeyman
Tags
Bearer Token, Dependency Override, fastapi, Parametrized Test, rest-api, Test Fixture (python)