27 lines
658 B
Python
27 lines
658 B
Python
# scopes.tests.test_api
|
|
|
|
"""Tests for the fastapi- (and asyncio-) based stuff."""
|
|
|
|
import sys
|
|
print('***', sys.path)
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from httpx2 import ASGITransport, AsyncClient
|
|
|
|
from scopes.api.main import app
|
|
|
|
def async_client():
|
|
return AsyncClient(transport=ASGITransport(app=app), base_url='http://test')
|
|
|
|
#@pytest.mark.anyio
|
|
#async def test_root():
|
|
#async with async_client() as clt:
|
|
#response = await clt.get('/')
|
|
|
|
def test_root():
|
|
with TestClient(app) as clt:
|
|
response = clt.get('/')
|
|
assert response.status_code == 200
|
|
assert response.json() == {'Hello': 'World'}
|
|
|