fix(deps): fastapi 0.92.0 upgrade

middleware must be added before startup:

fixes: "RuntimeError: Cannot add middleware after an application has started"

https://fastapi.tiangolo.com/release-notes/#0910
Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-03-04 10:29:54 +01:00
parent c0390240bc
commit 52c962a590
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
2 changed files with 20 additions and 11 deletions

View file

@ -68,12 +68,19 @@ async def test_asgi_startup_session_secret_exception(monkeypatch):
@pytest.mark.asyncio
async def test_asgi_startup_exception(monkeypatch):
with mock.patch.dict(os.environ, {"AUR_CONFIG": "conf/config.defaults"}):
aurweb.config.rehash()
with pytest.raises(Exception):
await aurweb.asgi.app_startup()
aurweb.config.rehash()
async def test_asgi_startup_exception():
# save proper session secret
prev_secret = aurweb.asgi.session_secret
# remove secret
aurweb.asgi.session_secret = None
# startup should fail
with pytest.raises(Exception):
await aurweb.asgi.app_startup()
# restore previous session secret after test
aurweb.asgi.session_secret = prev_secret
@pytest.mark.asyncio