27 lines
674 B
Python
27 lines
674 B
Python
import asyncio
|
|
|
|
from app.nqi.adhoc import ENTRY, ensure_session
|
|
|
|
|
|
def test_adhoc_session_uses_the_registered_service():
|
|
assert ENTRY.endswith("/pro-adhoc/index")
|
|
seen = {}
|
|
|
|
class Response:
|
|
status_code = 200
|
|
|
|
class url:
|
|
path = "/pro-adhoc/index"
|
|
|
|
class Client:
|
|
async def _request(self, method, url, **kwargs):
|
|
seen["method"] = method
|
|
seen["url"] = url
|
|
seen["accept"] = kwargs["headers"]["Accept"]
|
|
return Response()
|
|
|
|
asyncio.run(ensure_session(Client()))
|
|
assert seen["method"] == "GET"
|
|
assert seen["url"] == ENTRY
|
|
assert seen["accept"].startswith("text/html")
|