add command-line options for Uvicorn server configuration
This commit is contained in:
@@ -65,3 +65,26 @@ def test_capture_routes_are_scoped_to_the_browser_session(tmp_path, monkeypatch)
|
||||
stats = client.get("/api/stats")
|
||||
assert stats.status_code == 200
|
||||
assert stats.json()["active_crawls"] == 1
|
||||
|
||||
|
||||
def test_run_forwards_server_options_to_uvicorn(monkeypatch) -> None:
|
||||
calls: list[tuple[tuple[object, ...], dict[str, object]]] = []
|
||||
|
||||
def fake_run(*args: object, **kwargs: object) -> None:
|
||||
calls.append((args, kwargs))
|
||||
|
||||
monkeypatch.setattr(main.uvicorn, "run", fake_run)
|
||||
|
||||
main.run(["--port", "9123", "--workers", "2"])
|
||||
|
||||
assert calls == [
|
||||
(
|
||||
("app.main:app",),
|
||||
{
|
||||
"host": settings.host,
|
||||
"port": 9123,
|
||||
"workers": 2,
|
||||
"reload": False,
|
||||
},
|
||||
)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user