Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/unit/app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Init of tests/unit/app."""
32 changes: 32 additions & 0 deletions tests/unit/app/test_routers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Unit tests for routers.py."""

from app.routers import include_routers # noqa:E402

from app.endpoints import root, info, models, query, health, config # noqa:E402


class MockFastAPI:
"""Mock class for FastAPI."""

def __init__(self):
"""Initialize mock class."""
self.routers = []

def include_router(self, router, prefix=None):
"""Register new router."""
self.routers.append(router)


def test_include_routers():
"""Test the function include_routers."""
app = MockFastAPI()
include_routers(app)

# are all routers added?
assert len(app.routers) == 6
assert root.router in app.routers
assert info.router in app.routers
assert models.router in app.routers
assert query.router in app.routers
assert health.router in app.routers
assert config.router in app.routers