From 9bd56e450818777bf5745d4b8785ad469480f5be Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Wed, 3 Apr 2024 16:26:32 +0200 Subject: [PATCH] fixup! Issue #139 remove deprecated `collection_whitelist` config --- tests/test_views.py | 46 --------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/tests/test_views.py b/tests/test_views.py index c51eeda..3c99b3d 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -275,52 +275,6 @@ def test_collections_links(self, api100, requests_mock, backend1, backend2): "links": [], } - @pytest.mark.parametrize( - ["collection_whitelist", "expected"], - [ - (None, {"S1", "S2", "S3", "S4"}), - ([], {"S1", "S2", "S3", "S4"}), - (["S2"], {"S2"}), - (["S4"], {"S4"}), - (["S2", "S3"], {"S2", "S3"}), - (["S2", "S999"], {"S2"}), - (["S999"], set()), - ([re.compile(r"S[23]")], {"S2", "S3"}), - ([re.compile(r"S")], set()), - ([re.compile(r"S.*")], {"S1", "S2", "S3", "S4"}), - ([re.compile(r"S2.*")], {"S2"}), - ([re.compile(r".*2")], {"S2"}), - ], - ) - def test_collections_whitelist_legacy( - self, api100, requests_mock, backend1, backend2, collection_whitelist, expected - ): - requests_mock.get(backend1 + "/collections", json={"collections": [{"id": "S1"}, {"id": "S2"}, {"id": "S3"}]}) - for cid in ["S1", "S2", "S3"]: - requests_mock.get(backend1 + f"/collections/{cid}", json={"id": cid, "title": f"b1 {cid}"}) - requests_mock.get(backend2 + "/collections", json={"collections": [{"id": "S3"}, {"id": "S4"}]}) - for cid in ["S3", "S4"]: - requests_mock.get(backend2 + f"/collections/{cid}", json={"id": cid, "title": f"b2 {cid}"}) - - with config_overrides(collection_whitelist=collection_whitelist): - res = api100.get("/collections").assert_status_code(200).json - assert set(c["id"] for c in res["collections"]) == expected - - res = api100.get("/collections/S2") - if "S2" in expected: - assert res.assert_status_code(200).json == DictSubSet({"id": "S2", "title": "b1 S2"}) - else: - res.assert_error(404, "CollectionNotFound") - - res = api100.get("/collections/S3") - if "S3" in expected: - assert res.assert_status_code(200).json == DictSubSet({"id": "S3", "title": "b1 S3"}) - else: - res.assert_error(404, "CollectionNotFound") - - res = api100.get("/collections/S999") - res.assert_error(404, "CollectionNotFound") - @pytest.mark.parametrize( ["collection_allow_list", "expected"], [