Unverified Commit 7722cf0e authored by Martin Cech's avatar Martin Cech Committed by GitHub
Browse files

Merge pull request #18040 from mvdbeek/show_error_on_wrong_quota_source_fitler

[24.0] Change wrong quota_source value from KeyError to ValueError
parents 44782a44 857a14e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -592,7 +592,7 @@ class HistoryContentsFilters(
                    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)

+7 −0
Original line number Diff line number Diff line
@@ -196,6 +196,13 @@ class TestQuotaIntegration(integration_util.IntegrationTestCase):
        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)