set upper bound on django-import-export dependency version (#36774)
* so as to maintain the role CSV export feature
This commit is contained in:
parent
cdc2cf567c
commit
5b8b62a19f
|
@ -21,6 +21,7 @@ Depends: ${misc:Depends}, ${python:Depends},
|
||||||
python-gadjo (>= 0.53),
|
python-gadjo (>= 0.53),
|
||||||
python-django-tables2 (>= 1),
|
python-django-tables2 (>= 1),
|
||||||
python-django-import-export (>= 0.2.7),
|
python-django-import-export (>= 0.2.7),
|
||||||
|
python-django-import-export (<= 0.4.5),
|
||||||
python-djangorestframework (>= 3.3),
|
python-djangorestframework (>= 3.3),
|
||||||
python-markdown (>= 2.1),
|
python-markdown (>= 2.1),
|
||||||
python-ldap (>= 2.4),
|
python-ldap (>= 2.4),
|
||||||
|
|
|
@ -21,7 +21,7 @@ The other Authentic 2 dependencies are:
|
||||||
- django-select2>=4.3.0
|
- django-select2>=4.3.0
|
||||||
- django-tables2>=1.0
|
- django-tables2>=1.0
|
||||||
- gadjo>=0.6
|
- gadjo>=0.6
|
||||||
- django-import-export>=0.2.7
|
- django-import-export>=0.2.7,<=0.4.5
|
||||||
- djangorestframework>=3.3
|
- djangorestframework>=3.3
|
||||||
- six>=1.9
|
- six>=1.9
|
||||||
- Markdown>=2.5
|
- Markdown>=2.5
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -123,7 +123,7 @@ setup(name="authentic2",
|
||||||
'Django-Select2>5,<6',
|
'Django-Select2>5,<6',
|
||||||
'django-tables2>=1.0,<2.0',
|
'django-tables2>=1.0,<2.0',
|
||||||
'gadjo>=0.53',
|
'gadjo>=0.53',
|
||||||
'django-import-export>=0.2.7',
|
'django-import-export>=0.2.7,<=0.4.5',
|
||||||
'djangorestframework>=3.3,<3.5',
|
'djangorestframework>=3.3,<3.5',
|
||||||
'six>=1',
|
'six>=1',
|
||||||
'Markdown>=2.1',
|
'Markdown>=2.1',
|
||||||
|
|
|
@ -17,6 +17,8 @@ from utils import login
|
||||||
|
|
||||||
|
|
||||||
def test_manager_role_export(app, admin, ou1, role_ou1, ou2, role_ou2):
|
def test_manager_role_export(app, admin, ou1, role_ou1, ou2, role_ou2):
|
||||||
|
import csv
|
||||||
|
|
||||||
response = login(app, admin, 'a2-manager-roles')
|
response = login(app, admin, 'a2-manager-roles')
|
||||||
|
|
||||||
export_response = response.click('JSON')
|
export_response = response.click('JSON')
|
||||||
|
@ -26,6 +28,14 @@ def test_manager_role_export(app, admin, ou1, role_ou1, ou2, role_ou2):
|
||||||
assert len(export['roles']) == 2
|
assert len(export['roles']) == 2
|
||||||
assert set([role['slug'] for role in export['roles']]) == set(['role_ou1', 'role_ou2'])
|
assert set([role['slug'] for role in export['roles']]) == set(['role_ou1', 'role_ou2'])
|
||||||
|
|
||||||
|
export_response = response.click('CSV')
|
||||||
|
reader = csv.reader(export_response.body.split('\r\n'), delimiter=',')
|
||||||
|
rows = [row for row in reader]
|
||||||
|
|
||||||
|
assert rows[0] == ['name', 'slug', 'members']
|
||||||
|
assert len(rows)-2 == 2 # csv header and last EOL
|
||||||
|
assert set([row[1] for row in rows[1:3]]) == set(['role_ou1', 'role_ou2'])
|
||||||
|
|
||||||
response.form.set('search-text', 'role_ou1')
|
response.form.set('search-text', 'role_ou1')
|
||||||
search_response = response.form.submit()
|
search_response = response.form.submit()
|
||||||
|
|
||||||
|
@ -36,6 +46,14 @@ def test_manager_role_export(app, admin, ou1, role_ou1, ou2, role_ou2):
|
||||||
assert len(export['roles']) == 1
|
assert len(export['roles']) == 1
|
||||||
assert export['roles'][0]['slug'] == 'role_ou1'
|
assert export['roles'][0]['slug'] == 'role_ou1'
|
||||||
|
|
||||||
|
export_response = search_response.click('CSV')
|
||||||
|
reader = csv.reader(export_response.body.split('\r\n'), delimiter=',')
|
||||||
|
rows = [row for row in reader]
|
||||||
|
|
||||||
|
assert rows[0] == ['name', 'slug', 'members']
|
||||||
|
assert len(rows)-2 == 1 # csv header and last EOL
|
||||||
|
assert rows[1][1] == 'role_ou1'
|
||||||
|
|
||||||
|
|
||||||
def test_manager_role_name_uniqueness_single_ou(app, admin):
|
def test_manager_role_name_uniqueness_single_ou(app, admin):
|
||||||
response = login(app, admin, 'a2-manager-roles')
|
response = login(app, admin, 'a2-manager-roles')
|
||||||
|
|
Loading…
Reference in New Issue