@@ -189,17 +189,17 @@ async def test_get_project_directory_config_missing(
189189async 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
205205async def test_get_project_directory_exists (
@@ -517,15 +517,15 @@ async def test_post_project_directory_config_missing(
517517async 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
531531async def test_post_project_directory_not_exists (
0 commit comments