from httpx import AsyncClient from src.core.settings import settings from src.schemas.users import User async def test_registration(ac): user = {"username": "kot", "email": "super@kot.ru", "password": "P@ssw0rd"} result = await ac.post( f"{settings.api.v1_login_url}/signup", json=user, ) assert result.status_code == 200 assert User.model_validate(result.json()) assert result.json()["is_active"] async def test_login(ac: AsyncClient): result = await ac.post( f"{settings.api.v1_login_url}/login", data={ "grant_type": "password", "username": "kot", "password": "P@ssw0rd", }, ) assert result.status_code == 200 assert result.json().get("access_token")