tests: run against Python 3

This commit is contained in:
Frédéric Péters 2020-01-17 14:21:42 +01:00
parent a9ee9454cc
commit bb8a29bdc8
5 changed files with 20 additions and 18 deletions

View File

@ -13,7 +13,7 @@ test -d wcs || git clone git://repos.entrouvert.org/wcs.git
(cd wcs && git pull)
(cd wcs && git clean -xdf)
virtualenv --system-site-packages venv
virtualenv -p /usr/bin/python3 --system-site-packages venv
PIP_BIN=venv/bin/pip
rm -f coverage.xml
@ -26,11 +26,11 @@ omit = wcs/qommon/vendor/*.py
omit = wcs/qommon/vendor/*.py
_EOF_
$PIP_BIN install --upgrade 'pip<8'
$PIP_BIN install --upgrade 'pip'
$PIP_BIN install --upgrade setuptools
$PIP_BIN install --upgrade 'pytest<4.3' 'attrs<19.2' 'more-itertools<6' WebTest mock pytest-cov
$PIP_BIN install --upgrade 'pylint<1.8' # 1.8 broken (cf wcs build #3023)
$PIP_BIN install --upgrade 'Django<1.12' 'gadjo' 'pyproj<2' 'requests' 'django-ratelimit<3'
$PIP_BIN install --upgrade 'pytest' 'attrs' 'more-itertools' WebTest mock pytest-cov
$PIP_BIN install --upgrade 'pylint'
$PIP_BIN install --upgrade 'Quixote>=3.0' 'Django<1.12' 'gadjo' 'vobject' 'pyproj<2' 'requests' 'django-ratelimit<3'
$PIP_BIN install git+https://git.entrouvert.org/debian/django-ckeditor.git
DJANGO_SETTINGS_MODULE=wcs.settings \

View File

@ -1,6 +1,6 @@
import os
import shutil
import StringIO
from django.utils.six import StringIO
import time
try:
@ -74,7 +74,7 @@ def test_with_superuser():
app = login(get_app(pub))
resp = app.get('/backoffice/')
# this makes sure the extension loaded properly
assert '<span id="applabel">Publik</span>' in resp.body
assert '<span id="applabel">Publik</span>' in resp.text
def test_general_admin_permissions():
create_superuser()
@ -93,7 +93,7 @@ def test_aq_permissions_panel(empty_siteoptions):
create_superuser()
app = login(get_app(pub))
resp = app.get('/backoffice/settings/')
assert not 'aq/permissions' in resp.body
assert not 'aq/permissions' in resp.text
with open(os.path.join(pub.app_dir, 'site-options.cfg'), 'w') as fd:
if not pub.site_options.has_section('options'):
@ -102,7 +102,7 @@ def test_aq_permissions_panel(empty_siteoptions):
pub.site_options.write(fd)
resp = app.get('/backoffice/settings/')
assert 'aq/permissions' in resp.body
assert 'aq/permissions' in resp.text
resp = app.get('/backoffice/settings/aq/permissions')
def test_menu_items(empty_siteoptions):
@ -132,26 +132,26 @@ def test_menu_items(empty_siteoptions):
app = login(get_app(pub))
resp = app.get('/backoffice/')
assert not '/%s/' % area in resp.body
assert not '/%s/' % area in resp.text
resp = app.get('/backoffice/%s/' % area, status=403)
pub.cfg['aq-permissions'] = {area: 'XXX'}
pub.write_cfg()
resp = app.get('/backoffice/')
assert '/%s/' % area in resp.body
assert '/%s/' % area in resp.text
resp = app.get('/backoffice/%s/' % area, status=200)
user1.is_admin = False
user1.roles = [role.id]
user1.store()
resp = app.get('/backoffice/')
assert not '/%s/' % area in resp.body
assert not '/%s/' % area in resp.text
resp = app.get('/backoffice/%s/' % area, status=403)
user1.is_admin = False
user1.roles = [role.id, 'XXX']
user1.store()
resp = app.get('/backoffice/')
assert '/%s/' % area in resp.body
assert '/%s/' % area in resp.text
resp = app.get('/backoffice/%s/' % area, status=200)

View File

@ -1,6 +1,6 @@
import os
import shutil
import StringIO
from django.utils.six import StringIO
import time
import pytest
@ -92,8 +92,8 @@ def test_with_agent_submitter():
resp = app.get('/backoffice/', status=200) # no redirect
# check the management and submission links are presend twice, once in the
# sidebar and once in the page body
assert resp.body.count('//example.net/backoffice/management/') == 2
assert resp.body.count('//example.net/backoffice/submission/') == 2
assert resp.text.count('//example.net/backoffice/management/') == 2
assert resp.text.count('//example.net/backoffice/submission/') == 2
formdef.backoffice_submission_roles = ['blah']
formdef.store()

View File

@ -1,6 +1,6 @@
import os
import shutil
import StringIO
from django.utils.six import StringIO
import time
import pytest
@ -84,11 +84,13 @@ def test_myspace_with_user_forms():
formdata = formdef.data_class()()
formdata.user_id = user.id
formdata.status = 'wf-st1'
formdata.receipt_time = time.localtime()
formdata.data = {}
formdata.store()
draft = formdef.data_class()()
draft.user_id = user.id
draft.status = 'draft'
draft.receipt_time = time.localtime()
draft.data = {}
draft.store()

View File

@ -1,4 +1,4 @@
import ConfigParser
from django.utils.six.moves import configparser as ConfigParser
import os
import tempfile