allow_facet, allow_download, suggest_facets boolean --config

Refs #284
This commit is contained in:
Simon Willison 2018-05-24 18:12:27 -07:00
commit 50920cfe3d
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52
9 changed files with 177 additions and 55 deletions

View file

@ -468,6 +468,33 @@ def test_table_metadata(app_client):
assert_footer_links(soup)
def test_allow_download_on(app_client):
response = app_client.get(
"/test_tables",
gather_request=False
)
soup = Soup(response.body, 'html.parser')
assert len(soup.findAll('a', {'href': re.compile('\.db$')}))
def test_allow_download_off():
for client in app_client(config={
'allow_download': False,
}):
response = client.get(
"/test_tables",
gather_request=False
)
soup = Soup(response.body, 'html.parser')
assert not len(soup.findAll('a', {'href': re.compile('\.db$')}))
# Accessing URL directly should 403
response = client.get(
"/test_tables.db",
gather_request=False
)
assert 403 == response.status
def assert_querystring_equal(expected, actual):
assert sorted(expected.split('&')) == sorted(actual.split('&'))