refactor: extract admin api router
This commit is contained in:
@@ -396,7 +396,7 @@ def test_admin_can_start_and_list_official_import(monkeypatch) -> None:
|
||||
db.refresh(run)
|
||||
return run
|
||||
|
||||
monkeypatch.setattr("app.main.import_records", fake_import)
|
||||
monkeypatch.setattr("app.routers.admin.import_records", fake_import)
|
||||
headers = {"Authorization": "Bearer change-me-in-production"}
|
||||
started = client.post("/api/v1/admin/imports/official-records", headers=headers)
|
||||
assert started.status_code == 201
|
||||
@@ -407,7 +407,7 @@ def test_admin_can_start_and_list_official_import(monkeypatch) -> None:
|
||||
def busy_import(*args, **kwargs):
|
||||
raise ImportAlreadyRunning("official import is already running")
|
||||
|
||||
monkeypatch.setattr("app.main.import_records", busy_import)
|
||||
monkeypatch.setattr("app.routers.admin.import_records", busy_import)
|
||||
conflict = client.post("/api/v1/admin/imports/official-records", headers=headers)
|
||||
assert conflict.status_code == 409
|
||||
|
||||
@@ -431,7 +431,7 @@ def test_admin_delete_anonymizes_report_removes_screenshot_and_keeps_audit(monke
|
||||
report.screenshot_key = "reports/private.jpg"
|
||||
db.commit()
|
||||
deleted_keys: list[str] = []
|
||||
monkeypatch.setattr("app.main.delete_screenshot", deleted_keys.append)
|
||||
monkeypatch.setattr("app.routers.admin.delete_screenshot", deleted_keys.append)
|
||||
headers = {"Authorization": "Bearer change-me-in-production"}
|
||||
response = client.delete(f"/api/v1/admin/catch-reports/{created['id']}?expected_version=0", headers=headers)
|
||||
assert response.status_code == 204
|
||||
|
||||
Reference in New Issue
Block a user