Created
January 27, 2020 17:36
-
-
Save cosmic-cortex/a27b221d594bba8a4ea67497f2825354 to your computer and use it in GitHub Desktop.
Configurations and fixtures for API testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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