TorbatYar/backend/services/loyalty/app/tests/test_dependency.py
Mortezakoohjani e41ecfad4c Sync platform docs, infra, and module services with Accounting integration.
Include Loyalty/Communication/Sports Center backends and registry updates alongside production nginx and compose wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 22:35:23 +03:30

38 lines
1.1 KiB
Python

"""Dependency direction and DI tests."""
from __future__ import annotations
import inspect
from app.api import deps
from app.repositories.base import TenantBaseRepository
from app.repositories.foundation import MemberRepository
from app.services.foundation import MemberService
def test_repository_pattern():
assert issubclass(MemberRepository, TenantBaseRepository)
assert MemberRepository.model is not None
def test_service_depends_on_repository_not_api():
source = inspect.getsource(MemberService)
assert "fastapi" not in source.lower()
assert "MemberRepository" in source
def test_api_deps_expose_tenant_and_db():
assert hasattr(deps, "require_tenant")
assert hasattr(deps, "get_db")
assert hasattr(deps, "get_current_user")
def test_providers_are_protocols_only():
import app.providers.contracts as contracts
source = inspect.getsource(contracts)
assert "async def" in source
assert "class NotificationProvider" in source
assert "httpx" not in source
assert "sqlalchemy" not in source
assert "AsyncSession" not in source