authentic/tests/test_role_manager.py

23 lines
709 B
Python

from utils import login
def test_manager_role_export(app, admin, ou1, role_ou1, ou2, role_ou2):
response = login(app, admin, 'a2-manager-roles')
export_response = response.click('JSON')
export = export_response.json
assert export.keys() == ['roles']
assert len(export['roles']) == 2
assert set([role['slug'] for role in export['roles']]) == set(['role_ou1', 'role_ou2'])
response.form.set('search-text', 'role_ou1')
search_response = response.form.submit()
export_response = search_response.click('JSON')
export = export_response.json
assert export.keys() == ['roles']
assert len(export['roles']) == 1
assert export['roles'][0]['slug'] == 'role_ou1'