Skip to content

Commit

Permalink
fix(validate-data): add correct query parameter for requesting lists (D…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nora-Olivia-Ammann authored Jan 29, 2025
1 parent a0f8116 commit 443a8da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dsp_tools/commands/validate_data/api_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_lists(self) -> AllProjectLists:
return AllProjectLists(reformatted)

def _get_all_list_iris(self) -> dict[str, Any]:
response = self.api_con.get_with_endpoint(endpoint=f"admin/lists?{self.shortcode}")
response = self.api_con.get_with_endpoint(endpoint=f"admin/lists?projectShortcode={self.shortcode}")
if not response.ok:
msg = (
f"NON-OK RESPONSE | Request: GET all list IRIs | "
Expand Down
4 changes: 2 additions & 2 deletions test/unittests/commands/validate_data/test_api_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ def test_get_all_list_iris(self, list_connection: ListClient) -> None:
with patch.object(list_connection.api_con, "get_with_endpoint", return_value=mock_response) as patched_get:
result = list_connection._get_all_list_iris()
assert result == {"lists": []}
patched_get.assert_called_once_with(endpoint="admin/lists?9999")
patched_get.assert_called_once_with(endpoint="admin/lists?projectShortcode=9999")

def test_get_all_list_iris_non_ok_code(self, list_connection: ListClient) -> None:
mock_response = Mock()
mock_response.ok = False
with patch.object(list_connection.api_con, "get_with_endpoint", return_value=mock_response) as patched_get:
with pytest.raises(InternalError):
list_connection._get_all_list_iris()
patched_get.assert_called_once_with(endpoint="admin/lists?9999")
patched_get.assert_called_once_with(endpoint="admin/lists?projectShortcode=9999")

def test_get_one_list(self, list_connection: ListClient) -> None:
mock_response = Mock()
Expand Down

0 comments on commit 443a8da

Please sign in to comment.