Skip to content

Commit 187b0e7

Browse files
committed
MAINT: Address comments
1 parent ef5f58d commit 187b0e7

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/fmu_settings_api/v1/routes/project.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@
120120
[
121121
{
122122
"detail": (
123-
"Initialize the .fmu directory from a project root "
124-
f"containing {REQUIRED_PROJECT_DIRS_TEXT}."
123+
"Failed initializing .fmu directory. Initialize it from a "
124+
f"project root containing {REQUIRED_PROJECT_DIRS_TEXT}. "
125+
"Did not find: {missing_project_dirs}."
125126
),
126127
},
127128
],

tests/conftest.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,11 @@ async def client_with_session(session_id: str) -> AsyncGenerator[TestClient]:
274274

275275

276276
@pytest.fixture
277-
async def client_with_project_session(
278-
session_id: str, make_fmu_project_root: Callable[[Path], Path]
279-
) -> AsyncGenerator[TestClient]:
277+
async def client_with_project_session(session_id: str) -> AsyncGenerator[TestClient]:
280278
"""Returns a test client with a valid session."""
281279
session = await get_session(session_id)
282280

283-
path = make_fmu_project_root(session.user_fmu_directory.path.parent.parent)
281+
path = session.user_fmu_directory.path.parent.parent # tmp_path
284282
fmu_dir = init_fmu_directory(path)
285283
_ = await add_fmu_project_to_session(session_id, fmu_dir)
286284

@@ -290,13 +288,11 @@ async def client_with_project_session(
290288

291289

292290
@pytest.fixture
293-
async def client_with_smda_session(
294-
session_id: str, make_fmu_project_root: Callable[[Path], Path]
295-
) -> AsyncGenerator[TestClient]:
291+
async def client_with_smda_session(session_id: str) -> AsyncGenerator[TestClient]:
296292
"""Returns a test client with a valid session."""
297293
session = await get_session(session_id)
298294

299-
path = make_fmu_project_root(session.user_fmu_directory.path.parent.parent)
295+
path = session.user_fmu_directory.path.parent.parent # tmp_path
300296
fmu_dir = init_fmu_directory(path)
301297
_ = await add_fmu_project_to_session(session_id, fmu_dir)
302298

@@ -312,9 +308,9 @@ async def client_with_smda_session(
312308

313309

314310
@pytest.fixture
315-
def session_tmp_path(make_fmu_project_root: Callable[[Path], Path]) -> Path:
311+
def session_tmp_path() -> Path:
316312
"""Returns the tmp_path equivalent from a mocked user .fmu dir."""
317-
return make_fmu_project_root(UserFMUDirectory().path.parent.parent)
313+
return UserFMUDirectory().path.parent.parent
318314

319315

320316
@pytest.fixture

tests/test_v1/test_project.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,9 @@ async def test_post_init_fmu_directory_invalid_project_root(
838838
response = client_with_session.post(f"{ROUTE}/init", json={"path": str(path)})
839839
assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
840840
detail = response.json()["detail"]
841+
assert detail.startswith("Failed initializing .fmu directory.")
841842
assert "project root containing" in detail
843+
assert "Did not find:" in detail
842844
for dir_name in REQUIRED_FMU_PROJECT_SUBDIRS:
843845
assert f"'{dir_name}'" in detail
844846

0 commit comments

Comments
 (0)