mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Moved plugin HTML tests from test_html to test_plugins
This commit is contained in:
parent
27c10f6482
commit
98c8f0e728
2 changed files with 25 additions and 13 deletions
|
|
@ -15,6 +15,31 @@ def test_plugins_dir_plugin(app_client):
|
|||
assert pytest.approx(328.0839) == response.json['rows'][0][0]
|
||||
|
||||
|
||||
def test_plugin_extra_css_urls(app_client):
|
||||
response = app_client.get('/', gather_request=False)
|
||||
links = Soup(response.body, 'html.parser').findAll('link')
|
||||
assert [
|
||||
l for l in links
|
||||
if l.attrs == {
|
||||
'rel': ['stylesheet'],
|
||||
'href': 'https://example.com/app.css'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_plugin_extra_js_urls(app_client):
|
||||
response = app_client.get('/', gather_request=False)
|
||||
scripts = Soup(response.body, 'html.parser').findAll('script')
|
||||
assert [
|
||||
s for s in scripts
|
||||
if s.attrs == {
|
||||
'integrity': 'SRIHASH',
|
||||
'crossorigin': 'anonymous',
|
||||
'src': 'https://example.com/jquery.js'
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_plugins_with_duplicate_js_urls(app_client):
|
||||
# If two plugins both require jQuery, jQuery should be loaded only once
|
||||
response = app_client.get(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue