tests: add basic xls export check
This commit is contained in:
parent
9c7c8633f2
commit
98d2204b13
|
@ -14,6 +14,11 @@ import zipfile
|
|||
|
||||
import pytest
|
||||
|
||||
try:
|
||||
import xlwt
|
||||
except ImportError:
|
||||
xlwt = None
|
||||
|
||||
from quixote import cleanup, get_publisher
|
||||
from qommon import ods
|
||||
from wcs.qommon import errors, sessions
|
||||
|
@ -862,6 +867,25 @@ def test_backoffice_ods(pub):
|
|||
assert row.findall('.//{%s}table-cell' % ods.NS['table'])[old_column].attrib[
|
||||
'{%s}date-value' % ods.NS['office']] == '1871-03-18'
|
||||
|
||||
@pytest.mark.skipif('xlwt is None')
|
||||
def test_backoffice_xls(pub):
|
||||
create_superuser(pub)
|
||||
create_environment(pub)
|
||||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/management/form-title/')
|
||||
assert not 'Excel Export' in resp.body
|
||||
|
||||
if not pub.site_options.has_section('options'):
|
||||
pub.site_options.add_section('options')
|
||||
pub.site_options.set('options', 'legacy-excel-export', 'true')
|
||||
fd = open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w')
|
||||
pub.site_options.write(fd)
|
||||
fd.close()
|
||||
|
||||
resp = app.get('/backoffice/management/form-title/')
|
||||
resp = resp.click('Excel Export')
|
||||
assert resp.headers['content-type'].startswith('application/vnd.ms-excel')
|
||||
|
||||
def test_backoffice_statistics(pub):
|
||||
create_superuser(pub)
|
||||
create_environment(pub)
|
||||
|
|
Loading…
Reference in New Issue