Finish to clean up local setting usage. Ref #1460

This commit is contained in:
grossmj
2022-03-31 12:05:47 +08:00
parent 2cddb2c05a
commit 888c773dc0
7 changed files with 8 additions and 22 deletions

View File

@ -30,6 +30,7 @@ pytestmark = pytest.mark.asyncio
async def test_shutdown_local(app: FastAPI, client: AsyncClient, config: Config) -> None:
os.kill = MagicMock()
config.settings.Server.local = True
response = await client.post(app.url_path_for("shutdown"))
assert response.status_code == status.HTTP_204_NO_CONTENT
assert os.kill.called
@ -37,7 +38,6 @@ async def test_shutdown_local(app: FastAPI, client: AsyncClient, config: Config)
async def test_shutdown_non_local(app: FastAPI, client: AsyncClient, config: Config) -> None:
config.settings.Server.local = False
response = await client.post(app.url_path_for("shutdown"))
assert response.status_code == status.HTTP_403_FORBIDDEN