import httpx
import pytest

from iperon import contrib
from iperon.http_base_client import HttpBaseClient


@pytest.mark.asyncio
async def test_depends_auth_member(app):
    cookie = httpx.Cookies()
    cookie.set(
        name='session',
        value=contrib.jwt.JWT().generate(),
        domain='.localhost.local',
    )

    async with HttpBaseClient(base_url='http://localhost.local', app=app) as client:
        response = await client.get(url='/api/v1/member/', cookies=cookie)
        assert response.status_code == 401
