Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pgorecki committed Jul 11, 2023
1 parent 8c2c377 commit 534a37e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from config.api_config import ApiConfig
from config.container import TopLevelContainer
from seedwork.domain.exceptions import DomainException, EntityNotFoundException
from seedwork.infrastructure.database import Base
from seedwork.infrastructure.logging import LoggerFactory, logger

# configure logger prior to first usage
Expand All @@ -25,7 +26,10 @@
app.include_router(diagnostics.router)
app.container = container

logger.info("using db engine %s" % str(container.db_engine()))
db_engine = container.db_engine()
logger.info(f"using db engine {db_engine}, creating tables")
Base.metadata.create_all(db_engine)
logger.info("setup complete")

try:
import uuid
Expand Down
13 changes: 4 additions & 9 deletions src/api/tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import pytest
from fastapi.testclient import TestClient

from api.main import app

client = TestClient(app)


@pytest.mark.integration
def test_homepage_returns_200():
response = client.get("/")
def test_homepage_returns_200(api_client):
response = api_client.get("/")
assert response.status_code == 200


@pytest.mark.integration
def test_docs_page_returns_200():
response = client.get("/docs")
def test_docs_page_returns_200(api_client):
response = api_client.get("/docs")
assert response.status_code == 200

0 comments on commit 534a37e

Please sign in to comment.