From c2aa29bc4caf32099e38b2a3a7ebb427f8c1ec69 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Tue, 9 Mar 2021 11:45:20 +0100 Subject: [PATCH] Use quotation marks for all id value tests --- tests/server/middleware/test_api_hint.py | 8 ++++---- tests/server/query_params/test_filter.py | 2 +- tests/server/routers/test_structures.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/server/middleware/test_api_hint.py b/tests/server/middleware/test_api_hint.py index bcda58174..2e89b0acf 100644 --- a/tests/server/middleware/test_api_hint.py +++ b/tests/server/middleware/test_api_hint.py @@ -11,7 +11,7 @@ def test_correct_api_hint(both_clients, check_response): links_id = "index" major_version = BASE_URL_PREFIXES["major"][1:] # Remove prefixed `/` - query_url = f"/links?api_hint={major_version}&filter=id={links_id}" + query_url = f'/links?api_hint={major_version}&filter=id="{links_id}"' check_response( request=query_url, @@ -27,7 +27,7 @@ def test_incorrect_api_hint(both_clients, check_error_response): links_id = "index" incorrect_version = int(BASE_URL_PREFIXES["major"][len("/v") :]) + 1 incorrect_version = f"v{incorrect_version}" - query_url = f"/links?api_hint={incorrect_version}&filter=id={links_id}" + query_url = f'/links?api_hint={incorrect_version}&filter=id="{links_id}"' with pytest.raises(VersionNotSupported): check_error_response( @@ -52,7 +52,7 @@ def test_url_changes(both_clients, get_good_response): links_id = "index" major_version = BASE_URL_PREFIXES["major"][1:] # Remove prefixed `/` - query_url = f"/links?filter=id={links_id}&api_hint={major_version}" + query_url = f'/links?filter=id="{links_id}"&api_hint={major_version}' response = get_good_response(query_url, server=both_clients, return_json=False) @@ -62,7 +62,7 @@ def test_url_changes(both_clients, get_good_response): ) # Now to make sure the redirect would not happen when leaving out `api_hint` - query_url = f"/links?filter=id={links_id}" + query_url = f'/links?filter=id="{links_id}"' response = get_good_response(query_url, server=both_clients, return_json=False) diff --git a/tests/server/query_params/test_filter.py b/tests/server/query_params/test_filter.py index 285145dcb..e5070dbb8 100644 --- a/tests/server/query_params/test_filter.py +++ b/tests/server/query_params/test_filter.py @@ -9,7 +9,7 @@ def test_custom_field(check_response): def test_id(check_response): - request = "/structures?filter=id=mpf_2" + request = '/structures?filter=id="mpf_2"' expected_ids = ["mpf_2"] check_response(request, expected_ids) diff --git a/tests/server/routers/test_structures.py b/tests/server/routers/test_structures.py index dd6b9096b..a1a601ac2 100644 --- a/tests/server/routers/test_structures.py +++ b/tests/server/routers/test_structures.py @@ -111,7 +111,7 @@ def test_structures_endpoint_data(self): class TestMultiStructureWithSharedRelationships(RegularEndpointTests): """Tests for /structures for entries with shared relationships""" - request_str = "/structures?filter=id=mpf_1 OR id=mpf_2" + request_str = '/structures?filter=id="mpf_1" OR id="mpf_2"' response_cls = StructureResponseMany def test_structures_endpoint_data(self): @@ -126,7 +126,7 @@ def test_structures_endpoint_data(self): class TestMultiStructureWithRelationships(RegularEndpointTests): """Tests for /structures for mixed entries with and without relationships""" - request_str = "/structures?filter=id=mpf_1 OR id=mpf_23" + request_str = '/structures?filter=id="mpf_1" OR id="mpf_23"' response_cls = StructureResponseMany def test_structures_endpoint_data(self): @@ -145,7 +145,7 @@ class TestMultiStructureWithOverlappingRelationships(RegularEndpointTests): some of these relationships overlap between the entries, others don't. """ - request_str = "/structures?filter=id=mpf_1 OR id=mpf_3" + request_str = '/structures?filter=id="mpf_1" OR id="mpf_3"' response_cls = StructureResponseMany def test_structures_endpoint_data(self):