Skip to content

Commit 3411cba

Browse files
authored
TST: Update test for invalid project config (#313)
1 parent f379856 commit 3411cba

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

tests/test_v1/test_project.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,17 @@ async def test_get_project_directory_config_missing(
189189
async def test_get_project_directory_corrupt(
190190
client_with_session: TestClient, session_tmp_path: Path, monkeypatch: MonkeyPatch
191191
) -> None:
192-
"""Test 500 returns when project .fmu has invalid config."""
192+
"""Test 422 returns when project .fmu has invalid config."""
193193
monkeypatch.chdir(session_tmp_path)
194194

195195
fmu_dir = init_fmu_directory(session_tmp_path)
196196
with open(fmu_dir.config.path, "w") as f:
197197
f.write("incorrect")
198198

199199
response = client_with_session.get(ROUTE)
200-
assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
200+
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
201201
detail = response.json()["detail"]
202-
assert detail == "An unexpected error occurred."
202+
assert "Invalid JSON in resource file" in detail
203203

204204

205205
async def test_get_project_directory_exists(
@@ -517,15 +517,15 @@ async def test_post_project_directory_config_missing(
517517
async def test_post_project_directory_corrupt(
518518
client_with_session: TestClient, session_tmp_path: Path
519519
) -> None:
520-
"""Test 500 returns when project .fmu has invalid config."""
520+
"""Test 422 returns when project .fmu has invalid config."""
521521
fmu_dir = init_fmu_directory(session_tmp_path)
522522
with open(fmu_dir.config.path, "w") as f:
523523
f.write("incorrect")
524524

525525
response = client_with_session.post(ROUTE, json={"path": str(session_tmp_path)})
526-
assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
526+
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
527527
detail = response.json()["detail"]
528-
assert detail == "An unexpected error occurred."
528+
assert "Invalid JSON in resource file" in detail
529529

530530

531531
async def test_post_project_directory_not_exists(

uv.lock

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)