Skip to content

Commit fc5bf87

Browse files
committed
Standardize trailing slash for resource URLs
1 parent 7c9b1da commit fc5bf87

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

django/sierra/api/tests/test_api.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,11 +2197,11 @@ def test_list_view_filters(resource, test_data, search, expected, api_settings,
21972197

21982198
# First let's do a quick sanity check to make sure the resource
21992199
# returns the correct num of records before the filter is applied.
2200-
full_resource_path = '{}{}'.format(API_ROOT, resource)
2201-
check_response = api_client.get('{}/'.format(full_resource_path))
2200+
resource_url = '{}{}/'.format(API_ROOT, resource)
2201+
check_response = api_client.get(resource_url)
22022202
assert check_response.data['totalCount'] == len(erecs) + len(trecs)
22032203

2204-
response = do_filter_search(full_resource_path, search, api_client)
2204+
response = do_filter_search(resource_url, search, api_client)
22052205
found_ids = set(get_found_ids(id_field, response))
22062206
assert all([i in found_ids for i in expected_ids])
22072207
assert all([i not in found_ids for i in not_expected_ids])
@@ -2225,8 +2225,8 @@ def test_list_view_orderby(resource, test_data, search, expected, api_settings,
22252225
id_field = RESOURCE_METADATA[resource]['id_field']
22262226
erecs, trecs = assemble_test_records(profile, id_field, test_data)
22272227
print [r.get('call_number_sort', None) for r in trecs]
2228-
full_resource_path = '{}{}'.format(API_ROOT, resource)
2229-
response = do_filter_search(full_resource_path, search, api_client)
2228+
resource_url = '{}{}/'.format(API_ROOT, resource)
2229+
response = do_filter_search(resource_url, search, api_client)
22302230
found_ids = get_found_ids(id_field, response)
22312231
assert found_ids == expected
22322232

@@ -2259,8 +2259,8 @@ def test_firstitemperlocation_list(test_data, search, expected, api_settings,
22592259
id_field = RESOURCE_METADATA[resource]['id_field']
22602260
assemble_test_records(profile, id_field, data[resource])
22612261

2262-
full_resource_path = '{}firstitemperlocation'.format(API_ROOT)
2263-
rsp = do_filter_search(full_resource_path, search, api_client)
2262+
resource_url = '{}firstitemperlocation/'.format(API_ROOT)
2263+
rsp = do_filter_search(resource_url, search, api_client)
22642264
found_ids = set(get_found_ids(RESOURCE_METADATA['items']['id_field'], rsp))
22652265
assert all([i in found_ids for i in expected_ids])
22662266
assert all([i not in found_ids for i in not_expected_ids])
@@ -2289,7 +2289,7 @@ def test_callnumbermatches_list(test_data, search, expected, api_settings,
22892289
id_field = RESOURCE_METADATA[resource]['id_field']
22902290
assemble_test_records(profile, id_field, data[resource])
22912291

2292-
full_resource_path = '{}callnumbermatches'.format(API_ROOT)
2293-
response = do_filter_search(full_resource_path, search, api_client)
2292+
resource_url = '{}callnumbermatches/'.format(API_ROOT)
2293+
response = do_filter_search(resource_url, search, api_client)
22942294
assert response.data == expected
22952295

django/sierra/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,10 @@ def do_filter_search():
821821
`resource` via the given `api_client` fixture. Returns the
822822
response.
823823
"""
824-
def _do_filter_search(resource, search, client):
824+
def _do_filter_search(resource_url, search, client):
825825
q = '&'.join(['='.join([urllib.quote_plus(v) for v in pair.split('=')])
826826
for pair in search.split('&')])
827-
return client.get('{}/?{}'.format(resource, q))
827+
return client.get('{}?{}'.format(resource_url, q))
828828
return _do_filter_search
829829

830830

0 commit comments

Comments
 (0)