Case insensitive querystring comparison, fix Python 3.5

pull/257/head
Simon Willison 2018-05-12 19:49:37 -03:00
rodzic eaaa3ea149
commit 4301a8f3ac
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 17E2DEA2588B7F52
1 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -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)