Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Jul 5, 2024
1 parent eaece0c commit e4e999c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/storage/business/test_raw_study_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_get(tmp_path: str, project_path) -> None:

assert output == data

study.get.assert_called_once_with(["settings"], depth=2, formatted=True)
study.get.assert_called_once_with(["settings"], depth=2, format="json")


@pytest.mark.unit_test
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/business/test_variant_study_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def task_status(*args):

assert output == data

study.get.assert_called_once_with(["settings"], depth=2, formatted=True)
study.get.assert_called_once_with(["settings"], depth=2, format="json")


@pytest.mark.unit_test
Expand Down
4 changes: 2 additions & 2 deletions tests/storage/integration/test_STA_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def assert_with_errors(
storage_service: StudyService,
url: str,
expected_output: Union[str, dict],
formatted: bool = True,
format: str = "json",
) -> None:
url = url[len("/v1/studies/") :]
uuid, url = url.split("/raw?path=")
params = RequestParameters(user=ADMIN)
output = storage_service.get(uuid=uuid, url=url, depth=3, formatted=formatted, params=params)
output = storage_service.get(uuid=uuid, url=url, depth=3, format=format, params=params)
assert_study(
output,
expected_output,
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/integration/test_write_STA_mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def assert_with_errors(
res = storage_service.edit_study(uuid=uuid, url=url, new=new, params=params)
assert res == new

res = storage_service.get(uuid=uuid, url=url, depth=-1, formatted=True, params=params)
res = storage_service.get(uuid=uuid, url=url, depth=-1, format="json", params=params)
if expected is not None:
assert res == expected
else:
Expand Down
8 changes: 3 additions & 5 deletions tests/storage/web/test_studies_bp.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ def test_server() -> None:
client = TestClient(app)
client.get("/v1/studies/study1/raw?path=settings/general/params")

mock_service.get.assert_called_once_with(
"study1", "settings/general/params", depth=3, formatted=True, params=PARAMS
)
mock_service.get.assert_called_once_with("study1", "settings/general/params", depth=3, format="json", params=PARAMS)


@pytest.mark.unit_test
Expand Down Expand Up @@ -123,7 +121,7 @@ def test_server_with_parameters() -> None:
parameters = RequestParameters(user=ADMIN)

assert result.status_code == HTTPStatus.OK
mock_storage_service.get.assert_called_once_with("study1", "/", depth=4, formatted=True, params=parameters)
mock_storage_service.get.assert_called_once_with("study1", "/", depth=4, format="json", params=parameters)

result = client.get("/v1/studies/study2/raw?depth=WRONG_TYPE")
assert result.status_code == HTTPStatus.UNPROCESSABLE_ENTITY
Expand All @@ -132,7 +130,7 @@ def test_server_with_parameters() -> None:
assert result.status_code == HTTPStatus.OK

excepted_parameters = RequestParameters(user=ADMIN)
mock_storage_service.get.assert_called_with("study2", "/", depth=3, formatted=True, params=excepted_parameters)
mock_storage_service.get.assert_called_with("study2", "/", depth=3, format="json", params=excepted_parameters)


@pytest.mark.unit_test
Expand Down

0 comments on commit e4e999c

Please sign in to comment.