Skip to content

Commit

Permalink
Merge pull request #18040 from mvdbeek/show_error_on_wrong_quota_sour…
Browse files Browse the repository at this point in the history
…ce_fitler

[24.0] Change wrong quota_source value from KeyError to ValueError
  • Loading branch information
martenson authored Apr 22, 2024
2 parents 44782a4 + 857a14e commit 7722cf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/galaxy/managers/history_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def get_filter(attr, op, val):
if val == "__null__":
val = None
if val not in ids:
raise KeyError(f"Could not find key {val} in object store keys {list(ids.keys())}")
raise ValueError(f"Could not find key {val} in object store keys {list(ids.keys())}")
object_store_ids = ids[val]
return sql.column("object_store_id").in_(object_store_ids)

Expand Down
7 changes: 7 additions & 0 deletions test/integration/test_quota.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ def test_quota_source_label_basics(self):
labels = [q["quota_source_label"] for q in quotas]
assert "mylabel" in labels

with self.dataset_populator.test_history() as history_id:
response = self.dataset_populator._get_contents_request(
history_id, data={"q": "quota_source_label-eq", "qv": "invalid", "v": "dev"}
)
assert response.status_code == 400
assert "unparsable value for filter" in response.json()["err_msg"]

def _create_quota_with_name(self, quota_name: str, is_default: bool = False):
payload = self._build_quota_payload_with_name(quota_name, is_default)
create_response = self._post("quotas", data=payload, json=True)
Expand Down

0 comments on commit 7722cf0

Please sign in to comment.