mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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:
parent
c0390240bc
commit
52c962a590
2 changed files with 20 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue