misc: require authentication to download ods (#35447)

This commit is contained in:
Frédéric Péters 2019-08-19 14:03:10 +02:00
parent b3839357a7
commit 9fbda03caf
2 changed files with 5 additions and 1 deletions

View File

@ -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):

View File

@ -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)