From 9fbda03cafbd03c58f818a231c7679c5a86f666a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 19 Aug 2019 14:03:10 +0200 Subject: [PATCH] misc: require authentication to download ods (#35447) --- bijoe/visualization/views.py | 2 +- tests/test_schema1.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bijoe/visualization/views.py b/bijoe/visualization/views.py index a69ded8..b4e899a 100644 --- a/bijoe/visualization/views.py +++ b/bijoe/visualization/views.py @@ -229,7 +229,7 @@ class CubeIframeView(CubeView): template_name = 'bijoe/cube_raw.html' -class VisualizationODSView(DetailView): +class VisualizationODSView(views.AuthorizationMixin, DetailView): model = models.Visualization def get(self, request, *args, **kwargs): diff --git a/tests/test_schema1.py b/tests/test_schema1.py index 8f6b639..69a667c 100644 --- a/tests/test_schema1.py +++ b/tests/test_schema1.py @@ -136,12 +136,16 @@ def test_ods(schema1, app, admin): response.form['name'] = 'test' response = response.form.submit().follow() ods_response = response.click(href='ods') + ods_url = ods_response.request.url # skip first line of ODS table as it's a header not present in the HTML display assert get_table(response) == get_ods_table(ods_response)[1:] root = get_ods_document(ods_response) nodes = root.findall('.//{%s}table-cell' % TABLE_NS) assert len([node for node in nodes if node.attrib['{%s}value-type' % OFFICE_NS] == 'float']) == 2 + app.reset() # logout + assert 'login' in app.get(ods_response.request.url, status=302).location + def test_truncated_previous_year_range_on_datetime(schema1, app, admin, freezer): login(app, admin)