DRAFT: Add support for the OCSP/CRL refresh wrapper REST API #414
104 tests run, 51 passed, 1 skipped, 52 failed.
Annotations
Check failure on line 126 in .mypy_cache/3.11/tests/test_auth.data.json
github-actions / JUnit report (local)
test_auth.test_valid_user_mtls
asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fe88862d350>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fe888720990>, 'asgi': {'version': '3.0'}, 'endpoint': <function return_validuser_payload at 0x7fe88a229b20>, 'fastapi_astack': <contextlib.AsyncExitStack object at 0x7fe88862ecd0>, ...}
receive = <bound method Queue.get of <Queue at 0x7fe88862e210 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fe888769580>
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
# Not going to handle this, pass onwards
if scope["type"] != "http" or not self._conn_for_req:
await self.app(scope, receive, send)
return
# Get and release connection
scope["connection"] = await self.gino.acquire(lazy=True)
try:
> await self.app(scope, receive, send)
src/rasenmaeher_api/db/middleware.py:107:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:64: in wrapped_app
raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:758: in __call__
await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:778: in app
await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:299: in handle
await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:79: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:64: in wrapped_app
raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:74: in app
response = await func(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:285: in app
raise e
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:275: in app
solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:598: in solve_dependencies
solved = await call(**sub_values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1945: in _do_execute
result = await executor(stmt, None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E RuntimeError: Task <Task pending name='Task-409' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop
asyncpg/protocol/protocol.pyx:207: RuntimeError
During handling of the above exception, another exception occurred:
unauth_client = <async_asgi_testclient.testing.TestClient object at 0x7fe888735690>
two_users = (<rasenmaeher_api.db.people.Person object at 0x7fe88875ecd0>, <rasenmaeher_api.db.people.Person object at 0x7fe888767390>)
@pytest.mark.asyncio(scope="session")
async def test_valid_user_mtls(unauth_client: TestClient, two_users: Tuple[Person, Person]) -> None:
"""Test the valid user endpoint with valid and invalid CNs"""
client = unauth_client
for user in two_users:
client.headers.update({"X-ClientCert-DN": f"CN={user.callsign},O=N/A"})
> resp = await client.get("/api/v1/check-auth/validuser")
tests/test_auth.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:123: in __call__
await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:186: in __call__
raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:164: in __call__
await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:111: in __call__
await conn.release()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:219: in release
raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:209: in release
await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1500: in reset
await self.execute(reset_query, timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:350: in execute
result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:359: in query
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
asyncpg/protocol/protocol.pyx:744: InterfaceError
Check failure on line 70 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_person_crud
asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <asyncpg.pool.Pool max=10 min=10 cur=9 use=0>
clause = <sqlalchemy.sql.dml.Insert object at 0x7fe889fc7550>, multiparams = ()
params = {}, conn = <gino.engine.GinoConnection object at 0x7fe888735e10>
async def first(self, clause, *multiparams, **params):
"""
Runs :meth:`~.GinoConnection.first`, See :meth:`.all`.
"""
async with self.acquire(reuse=True) as conn:
> return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1925: in _do_execute
stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:433: in _get_statement
statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E RuntimeError: Task <Task pending name='Task-720' coro=<test_person_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:70> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop
asyncpg/protocol/protocol.pyx:166: RuntimeError
During handling of the above exception, another exception occurred:
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_person_crud(ginosession: None) -> None:
"""Test the db abstraction of persons and roles"""
_ = ginosession
obj = Person(callsign="DOGGO01a", certspath=str(uuid.uuid4()))
> await obj.create()
tests/test_db.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:219: in release
raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:209: in release
await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1500: in reset
await self.execute(reset_query, timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:350: in execute
result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:359: in query
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
asyncpg/protocol/protocol.pyx:744: InterfaceError
Check failure on line 132 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_enrollments_crud
RuntimeError: Task <Task pending name='Task-722' coro=<test_enrollments_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:132> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_enrollments_crud(ginosession: None) -> None:
"""Test the db abstraction enrollments"""
_ = ginosession
# Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
person = Person(callsign="MEGAMAN00a", certspath=str(uuid.uuid4()))
> await person.create()
tests/test_db.py:132:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-722' coro=<test_enrollments_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:132> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 178 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_enrollmentpools_crud
RuntimeError: Task <Task pending name='Task-723' coro=<test_enrollmentpools_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:178> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_enrollmentpools_crud(ginosession: None) -> None:
"""Test the db abstraction enrollments and enrollmentpools"""
_ = ginosession
# Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
person = Person(callsign="POOLBOYa", certspath=str(uuid.uuid4()))
> await person.create()
tests/test_db.py:178:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-723' coro=<test_enrollmentpools_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:178> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 221 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_enrollmentpools_list
RuntimeError: Task <Task pending name='Task-724' coro=<test_enrollmentpools_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:221> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_enrollmentpools_list(ginosession: None) -> None:
"""Test list methods"""
_ = ginosession
# Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
owner1 = Person(callsign="MASTER666a", certspath=str(uuid.uuid4()))
> await owner1.create()
tests/test_db.py:221:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/crud.py:477: in _create
row = await bind.first(q)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-724' coro=<test_enrollmentpools_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:221> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 254 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_enrollments_list
RuntimeError: Task <Task pending name='Task-725' coro=<test_enrollments_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:254> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_enrollments_list(ginosession: None) -> None:
"""Test list methods"""
_ = ginosession
# FIXME: should use fixtures instead of trusting on side effects from previous tests
# Created in test_enrollmentpools_list
> owner = await Person.by_callsign("MASTER666a")
tests/test_db.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-725' coro=<test_enrollments_list() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:254> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 282 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_seentokens_crud
RuntimeError: Task <Task pending name='Task-726' coro=<test_seentokens_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:282> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_seentokens_crud(ginosession: None) -> None:
"""Test the db abstraction for seen tokens"""
_ = ginosession
token = str(uuid.uuid4())
meta = {"koirat": "doggoi"}
with pytest.raises(NotFound):
> await SeenToken.by_token(token)
tests/test_db.py:282:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/nonces.py:40: in by_token
obj = await SeenToken.query.where(SeenToken.token == token).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-726' coro=<test_seentokens_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:282> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 304 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_logincodes_crud
RuntimeError: Task <Task pending name='Task-727' coro=<test_logincodes_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:304> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_logincodes_crud(ginosession: None) -> None:
"""Test the db abstraction for login codes"""
_ = ginosession
await jwt_init()
> code = await LoginCode.create_for_claims({"sub": "sotakoira"})
tests/test_db.py:304:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/logincodes.py:62: in create_for_claims
await LoginCode.by_code(code)
src/rasenmaeher_api/db/logincodes.py:45: in by_code
obj = await LoginCode.query.where(LoginCode.code == code).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-727' coro=<test_logincodes_crud() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:304> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 327 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_person_with_cert
RuntimeError: Task <Task pending name='Task-728' coro=<test_person_with_cert() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:327> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_person_with_cert(ginosession: None) -> None:
"""Test the cert creation with the classmethod (and revocation)"""
_ = ginosession
await mtls_init()
> person = await Person.create_with_cert("BINGO01a", {"kissa": "puuma"})
tests/test_db.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/people.py:60: in create_with_cert
await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-728' coro=<test_person_with_cert() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:327> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 354 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_person_with_cert_cfsslfail
RuntimeError: Task <Task pending name='Task-729' coro=<test_person_with_cert_cfsslfail() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:354> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fe88871cd50>
@pytest.mark.asyncio(scope="session")
async def test_person_with_cert_cfsslfail(ginosession: None, monkeypatch: pytest.MonkeyPatch) -> None:
"""Test the cert creation with the classmethod with CFSSL failure"""
_ = ginosession
await mtls_init()
peoplepath = Path(switchme_to_singleton_call.persistent_data_dir) / "private" / "people"
old_files = set(peoplepath.rglob("*"))
with monkeypatch.context() as mpatch:
mpatch.setattr(switchme_to_singleton_call, "cfssl_host", "http://nosuchost")
mpatch.setenv("RM_CFSSL_HOST", switchme_to_singleton_call.cfssl_host)
with pytest.raises(BackendError):
> await Person.create_with_cert("BONGO01a", {"kissa": "puuma"})
tests/test_db.py:354:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/people.py:60: in create_with_cert
await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-729' coro=<test_person_with_cert_cfsslfail() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:354> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 368 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_person_with_cert_duplicatename
RuntimeError: Task <Task pending name='Task-730' coro=<test_person_with_cert_duplicatename() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:368> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_person_with_cert_duplicatename(ginosession: None) -> None:
"""Test the cert creation with the classmethod but reserved callsign"""
_ = ginosession
await mtls_init()
callsign = "RUOSKA23a"
peoplepath = Path(switchme_to_singleton_call.persistent_data_dir) / "private" / "people"
> person = await Person.create_with_cert(callsign)
tests/test_db.py:368:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/people.py:60: in create_with_cert
await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-730' coro=<test_person_with_cert_duplicatename() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:368> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 385 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_pfx_parse
RuntimeError: Task <Task pending name='Task-731' coro=<test_pfx_parse() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:385> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
Raw output
ginosession = None
@pytest.mark.asyncio(scope="session")
async def test_pfx_parse(ginosession: None) -> None:
"""Test that the PFX file gets done"""
_ = ginosession
await mtls_init()
> person = await Person.create_with_cert("PFXMAN01a")
tests/test_db.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/people.py:60: in create_with_cert
await Person.by_callsign(callsign)
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:747: in first
async with self.acquire(reuse=True) as conn:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:142: in __aenter__
self._conn = await self._acquire()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:702: in _acquire
await dbapi_conn.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:39: in acquire
return await self._acquire(timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:74: in _acquire
self._conn = await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:229: in acquire
return await self._pool.acquire(timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:821: in _acquire
return await _acquire_impl()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:806: in _acquire_impl
proxy = await ch.acquire() # type: PoolConnectionProxy
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:136: in acquire
await self.connect()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:128: in connect
self._con = await self._pool._get_new_connection()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:502: in _get_new_connection
con = await connection.connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:2329: in connect
return await connect_utils._connect(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:991: in _connect
conn = await _connect_addr(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:828: in _connect_addr
return await __connect_addr(params, True, *args)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:873: in __connect_addr
tr, pr = await connector
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connect_utils.py:744: in _create_ssl_connection
tr, pr = await loop.create_connection(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:1069: in create_connection
sock = await self._connect_sock(
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:973: in _connect_sock
await self.sock_connect(sock, address)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_UnixSelectorEventLoop running=False closed=False debug=False>
sock = <socket.socket [closed] fd=-1, family=2, type=1, proto=6>
address = ('127.0.0.1', 5542)
async def sock_connect(self, sock, address):
"""Connect to a remote socket at address.
This method is a coroutine.
"""
base_events._check_ssl_socket(sock)
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
if sock.family == socket.AF_INET or (
base_events._HAS_IPv6 and sock.family == socket.AF_INET6):
resolved = await self._ensure_resolved(
address, family=sock.family, type=sock.type, proto=sock.proto,
loop=self,
)
_, _, _, _, address = resolved[0]
fut = self.create_future()
self._sock_connect(fut, sock, address)
try:
> return await fut
E RuntimeError: Task <Task pending name='Task-731' coro=<test_pfx_parse() running at /home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/tests/test_db.py:385> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:180]> got Future <Future pending cb=[BaseSelectorEventLoop._sock_write_done(30, handle=<Handle BaseS....0.1', 5542))>)()]> attached to a different loop
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/selector_events.py:634: RuntimeError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_enroll_show_verif_code[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_enroll_show_verifcode_bad_code[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_post_init[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_promote_demote[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_lock[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_accept[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_accept_no_such_user[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_invitecode_create[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_invitecode_dectivate[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_invitecode_activate[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_show_verifcode_no_permission
failed on setup with "rasenmaeher_api.db.errors.BackendError"
Raw output
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
> certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
src/rasenmaeher_api/db/people.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/cfssl/private.py:62: in sign_csr
async with session.post(url, json=payload, timeout=DEFAULT_TIMEOUT) as response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:1194: in __aenter__
self._resp = await self._coro
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py:504: in _request
with timer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.helpers.TimerContext object at 0x7fe881bc5450>
exc_type = <class 'asyncio.exceptions.CancelledError'>
exc_val = CancelledError(), exc_tb = <traceback object at 0x7fe88890a780>
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> Optional[bool]:
if self._tasks:
self._tasks.pop()
if exc_type is asyncio.CancelledError and self._cancelled:
> raise asyncio.TimeoutError from None
E TimeoutError
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/helpers.py:735: TimeoutError
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fe889d24540>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:365: in setup
res = await func(
tests/conftest.py:44: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 123 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_show_verifcode_sub_is_bonkers
asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
Raw output
self = <rasenmaeher_api.db.middleware.DBConnectionMiddleware object at 0x7fe8883b1710>
scope = {'app': <fastapi.applications.FastAPI object at 0x7fe888a08350>, 'asgi': {'version': '3.0'}, 'endpoint': <function req...show_verification_code at 0x7fe88a122a20>, 'fastapi_astack': <contextlib.AsyncExitStack object at 0x7fe888442c90>, ...}
receive = <bound method Queue.get of <Queue at 0x7fe8886a0cd0 maxsize=0 _queue=[{'type': 'http.request', 'body': b''}, {'type': 'http.disconnect'}] tasks=2>>
send = <function ServerErrorMiddleware.__call__.<locals>._send at 0x7fe8886cf9c0>
async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
# Not going to handle this, pass onwards
if scope["type"] != "http" or not self._conn_for_req:
await self.app(scope, receive, send)
return
# Get and release connection
scope["connection"] = await self.gino.acquire(lazy=True)
try:
> await self.app(scope, receive, send)
src/rasenmaeher_api/db/middleware.py:107:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py:62: in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:64: in wrapped_app
raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:758: in __call__
await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:778: in app
await route.handle(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:299: in handle
await self.app(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:79: in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:64: in wrapped_app
raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/_exception_handler.py:53: in wrapped_app
await app(scope, receive, sender)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/routing.py:74: in app
response = await func(request)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:285: in app
raise e
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/routing.py:275: in app
solved_result = await solve_dependencies(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:598: in solve_dependencies
solved = await call(**sub_values)
src/rasenmaeher_api/web/api/middleware/user.py:43: in __call__
request.state.person = await Person.by_callsign(payload.userid)
src/rasenmaeher_api/db/people.py:194: in by_callsign
obj = await Person.query.where(Person.callsign == callsign).gino.first()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/api.py:137: in first
return await self._query.bind.first(self._query, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:748: in first
return await conn.first(clause, *multiparams, **params)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/engine.py:328: in first
return await result.execute(one=True)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/base.py:214: in execute
rows = await cursor.async_execute(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/gino/dialects/asyncpg.py:184: in async_execute
result, stmt = await getattr(conn, "_do_execute")(query, executor, timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1925: in _do_execute
stmt = await self._get_statement(
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:433: in _get_statement
statement = await self._protocol.prepare(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E RuntimeError: Task <Task pending name='Task-830' coro=<FastAPI.__call__() running at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054> cb=[_callback(<bound method... _getters[1]>>)() at /home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:99]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop
asyncpg/protocol/protocol.pyx:166: RuntimeError
During handling of the above exception, another exception occurred:
tilauspalvelu_jwt_without_proper_user_client = <async_asgi_testclient.testing.TestClient object at 0x7fe8883b06d0>
@pytest.mark.asyncio(scope="session")
async def test_show_verifcode_sub_is_bonkers(tilauspalvelu_jwt_without_proper_user_client: TestClient) -> None:
"""
Test - sub in JWT cannot be found
"""
> resp = await tilauspalvelu_jwt_without_proper_user_client.get(
"/api/v1/enrollment/show-verification-code-info?verification_code=nosuchcode"
)
tests/test_enrollment.py:123:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:313: in get
return await self.open(*args, method="GET", **kwargs)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/testing.py:276: in open
async for chunk in response:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:46: in __aiter__
async for c in self.iter_content(128):
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:89: in iter_content
async for c in chunks:
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/response.py:70: in generate
message = await self.receive_or_fail()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:95: in receive
raise msg.reason
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/async_asgi_testclient/utils.py:101: in _callback
fut.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/fastapi/applications.py:1054: in __call__
await super().__call__(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/applications.py:123: in __call__
await self.middleware_stack(scope, receive, send)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:186: in __call__
raise exc
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py:164: in __call__
await self.app(scope, receive, _send)
src/rasenmaeher_api/db/middleware.py:111: in __call__
await conn.release()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:219: in release
raise ex
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/pool.py:209: in release
await self._con.reset(timeout=budget)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:1500: in reset
await self.execute(reset_query, timeout=timeout)
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/asyncpg/connection.py:350: in execute
result = await self._protocol.query(query, timeout)
asyncpg/protocol/protocol.pyx:359: in query
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress
asyncpg/protocol/protocol.pyx:744: InterfaceError