Skip to content

Instantly share code, notes, and snippets.

@cosmic-cortex
Created January 27, 2020 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosmic-cortex/a27b221d594bba8a4ea67497f2825354 to your computer and use it in GitHub Desktop.
Save cosmic-cortex/a27b221d594bba8a4ea67497f2825354 to your computer and use it in GitHub Desktop.
Configurations and fixtures for API testing
import pytest
from starlette.testclient import TestClient
from ..main import app
from ..ml.model import get_model
from .mocks import MockModel
def get_model_override():
model = MockModel()
return model
app.dependency_overrides[get_model] = get_model_override
@pytest.fixture()
def test_client():
return TestClient(app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment