mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7daecbcd32 |
||
|
|
0454c4458f |
1 changed files with 10 additions and 4 deletions
|
|
@ -99,8 +99,9 @@ def test_existing_filter_redirects(app_client):
|
||||||
path = path_base + '?' + urllib.parse.urlencode(filter_args)
|
path = path_base + '?' + urllib.parse.urlencode(filter_args)
|
||||||
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
||||||
assert response.status == 302
|
assert response.status == 302
|
||||||
assert response.headers['Location'].endswith(
|
assert_querystring_equal(
|
||||||
'?name__contains=hello&age__gte=22&age__lt=30&name__contains=world'
|
'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
|
# 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)
|
path = path_base + '?' + urllib.parse.urlencode(filter_args)
|
||||||
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
response = app_client.get(path, allow_redirects=False, gather_request=False)
|
||||||
assert response.status == 302
|
assert response.status == 302
|
||||||
assert response.headers['Location'].endswith(
|
assert_querystring_equal(
|
||||||
'?name__contains=hello&age__gte=22&name__contains=world'
|
'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
|
# ?_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)
|
assert_footer_links(soup)
|
||||||
|
|
||||||
|
|
||||||
|
def assert_querystring_equal(expected, actual):
|
||||||
|
assert sorted(expected.split('&')) == sorted(actual.split('&'))
|
||||||
|
|
||||||
|
|
||||||
def assert_footer_links(soup):
|
def assert_footer_links(soup):
|
||||||
footer_links = soup.find('div', {'class': 'ft'}).findAll('a')
|
footer_links = soup.find('div', {'class': 'ft'}).findAll('a')
|
||||||
assert 3 == len(footer_links)
|
assert 3 == len(footer_links)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue