Files
service-finder/backend/app/tests_internal/test_functional.py

31 lines
1.1 KiB
Python
Executable File

# /app/tests_internal/test_functional.py
"""
CÉL: Éles funkcionális teszt a bejelentkezési folyamathoz.
"""
import asyncio
from sqlalchemy import select
from app.database import AsyncSessionLocal
from app.models.identity import User
from app.services.auth_service import AuthService
async def test_login_flow():
print("\n--- 🔑 FUNKCIONÁLIS LOGIN TESZT ---")
async with AsyncSessionLocal() as db:
# 1. Keressünk egy teszt felhasználót
result = await db.execute(select(User).limit(1))
user = result.scalar_one_or_none()
if not user:
print("❌ HIBA: Nincs felhasználó az adatbázisban. Futtass egy seeder-t!")
return
print(f"👤 Tesztelés felhasználóval: {user.email}")
# 2. Próbáljunk meg egy 'hitelesítést' (jelszó ellenőrzés nélkül a DB szinten)
if user.is_active:
print(f"✅ SIKER: A(z) {user.email} fiók aktív és elérhető.")
else:
print(f"⚠️ FIGYELEM: A felhasználó létezik, de inaktív.")
if __name__ == "__main__":
asyncio.run(test_login_flow())