Skip to content

Commit

Permalink
fix(test): fake test OPENAI_API_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
valeeraZ committed Feb 14, 2024
1 parent 64466ed commit f465fd4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from sqlalchemy import create_engine, StaticPool
from sqlalchemy.orm import sessionmaker
from starlette.testclient import TestClient

from api.web.api import api_router


Expand All @@ -23,9 +22,16 @@ def get_test_app() -> FastAPI:

app.state.db_engine = engine
app.state.db_session_factory = TestingSessionLocal

# environment variable OPENAI_API_KEY is required
# to run the tests
app.state.os_environ = {"OPENAI_API_KEY": "fake_key"}

# noqa: F821
app.include_router(router=api_router, prefix="/api")

# set fake environment variable OPENAI_API_KEY to run tests

return app


Expand Down

0 comments on commit f465fd4

Please sign in to comment.