diff --git a/tests/test_html.py b/tests/test_html.py index cc227f7b..b333362f 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -416,19 +416,6 @@ def test_view_html(app_client): assert expected == [[str(td) for td in tr.select('td')] for tr in table.select('tbody tr')] -def test_plugin_extra_css_urls(app_client): - response = app_client.get('/', gather_request=False) - assert b'' in response.body - - -def test_plugin_extra_js_urls(app_client): - response = app_client.get('/', gather_request=False) - assert ( - b'' - in response.body - ) - - def test_index_metadata(app_client): response = app_client.get('/', gather_request=False) assert response.status == 200 diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 147050ac..d6411965 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -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(