From 6bcc277e352be2936924422216fdf740daade071 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Mon, 19 Oct 2020 13:17:12 +0200 Subject: [PATCH] fix: classic template did not pass base_url to macro Fixes #734 --- .../voila/templates/classic/index.html.j2 | 2 +- tests/app/template_sanity_test.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/app/template_sanity_test.py diff --git a/share/jupyter/voila/templates/classic/index.html.j2 b/share/jupyter/voila/templates/classic/index.html.j2 index b493a0be7..5f8336ec7 100644 --- a/share/jupyter/voila/templates/classic/index.html.j2 +++ b/share/jupyter/voila/templates/classic/index.html.j2 @@ -43,6 +43,6 @@ {% endblock body_header %} {% block footer_js %} -{{ voila_setup() }} +{{ voila_setup(resources.base_url, resources.nbextensions) }} {% endblock footer_js %} diff --git a/tests/app/template_sanity_test.py b/tests/app/template_sanity_test.py new file mode 100644 index 000000000..7698bbeec --- /dev/null +++ b/tests/app/template_sanity_test.py @@ -0,0 +1,19 @@ +# tests basic things the templates should have +import pytest + +import os + +BASE_DIR = os.path.dirname(__file__) + + +@pytest.fixture(params=['lab', 'classic']) +def voila_args_extra(request): + return [f'--template={request.param}'] + + +async def test_lists_extension(http_server_client, base_url, voila_app): + response = await http_server_client.fetch(base_url) + assert response.code == 200 + html_text = response.body.decode('utf-8') + assert f'/voila/templates/{voila_app.voila_configuration.template}/static/voila.js' in html_text + assert '/voila/static/require.min.js' in html_text