Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Configurations and fixtures for API testing
import pytest
from starlette.testclient import TestClient
from ..main import app
from import get_model
from .mocks import MockModel
def get_model_override():
model = MockModel()
return model
app.dependency_overrides[get_model] = get_model_override
def test_client():
return TestClient(app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment