kopia lustrzana https://github.com/simonw/datasette
Case insensitive querystring comparison, fix Python 3.5
rodzic
eaaa3ea149
commit
4301a8f3ac
|
@ -99,8 +99,9 @@ def test_existing_filter_redirects(app_client):
|
|||
path = path_base + '?' + urllib.parse.urlencode(filter_args)
|
||||
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
||||
assert response.status == 302
|
||||
assert response.headers['Location'].endswith(
|
||||
'?name__contains=hello&age__gte=22&age__lt=30&name__contains=world'
|
||||
assert_querystring_equal(
|
||||
'name__contains=hello&age__gte=22&age__lt=30&name__contains=world',
|
||||
response.headers['Location'].split('?')[1],
|
||||
)
|
||||
|
||||
# Setting _filter_column_3 to empty string should remove *_3 entirely
|
||||
|
@ -108,8 +109,9 @@ def test_existing_filter_redirects(app_client):
|
|||
path = path_base + '?' + urllib.parse.urlencode(filter_args)
|
||||
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
||||
assert response.status == 302
|
||||
assert response.headers['Location'].endswith(
|
||||
'?name__contains=hello&age__gte=22&name__contains=world'
|
||||
assert_querystring_equal(
|
||||
'name__contains=hello&age__gte=22&name__contains=world',
|
||||
response.headers['Location'].split('?')[1],
|
||||
)
|
||||
|
||||
# ?_filter_op=exact should be removed if unaccompanied by _fiter_column
|
||||
|
@ -399,6 +401,10 @@ def test_table_metadata(app_client):
|
|||
assert_footer_links(soup)
|
||||
|
||||
|
||||
def assert_querystring_equal(expected, actual):
|
||||
assert sorted(expected.split('&')) == sorted(actual.split('&'))
|
||||
|
||||
|
||||
def assert_footer_links(soup):
|
||||
footer_links = soup.find('div', {'class': 'ft'}).findAll('a')
|
||||
assert 3 == len(footer_links)
|
||||
|
|
Ładowanie…
Reference in New Issue