From c77aff7bd63468552ae2b6a678d3d5ed4f21f92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 22 Apr 2015 12:13:00 +0200 Subject: [PATCH 10/11] tests: replace admin/ by backoffice/ in tests of admin pages (#6726) --- tests/test_admin_pages.py | 336 +++++++++++++++++++++++----------------------- 1 file changed, 168 insertions(+), 168 deletions(-) diff --git a/tests/test_admin_pages.py b/tests/test_admin_pages.py index da6ac5d..95355cb 100644 --- a/tests/test_admin_pages.py +++ b/tests/test_admin_pages.py @@ -61,21 +61,21 @@ def teardown_module(module): shutil.rmtree(pub.APP_DIR) def test_empty_site(): - get_app(pub).get('/admin/') + get_app(pub).get('/backoffice/') def test_with_user(): create_superuser() - resp = get_app(pub).get('/admin/', status=302) + resp = get_app(pub).get('/backoffice/', status=302) resp = resp.follow() assert resp.location == 'http://example.net/login/' def test_with_superuser(): app = login(get_app(pub)) - app.get('/admin/') + app.get('/backoffice/') def test_forms(): app = login(get_app(pub)) - resp = app.get('/admin/forms/') + resp = app.get('/backoffice/forms/') assert 'You first have to define roles.' in resp.body assert not 'New Form' in resp.body @@ -84,12 +84,12 @@ def test_forms_new(): create_role() # create a new form - resp = app.get('/admin/forms/') + resp = app.get('/backoffice/forms/') assert 'New Form' in resp.body resp = resp.click('New Form') resp.forms[0]['name'] = 'form title' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/' + assert resp.location == 'http://example.net/backoffice/forms/1/' resp = resp.follow() assert 'Form - form title' in resp.body @@ -111,7 +111,7 @@ def test_forms_edit(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') # try changing an option assert 'Include confirmation page' in resp.body @@ -119,18 +119,18 @@ def test_forms_edit(): assert resp.forms[0]['confirmation'].checked resp.forms[0]['confirmation'].checked = False resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/' + assert resp.location == 'http://example.net/backoffice/forms/1/' resp = resp.follow() assert not 'Include confirmation page' in resp.body assert FormDef.get(1).confirmation == False # try changing title - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='title') assert resp.forms[0]['name'].value == 'form title' resp.forms[0]['name'] = 'new title' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/' + assert resp.location == 'http://example.net/backoffice/forms/1/' resp = resp.follow() assert FormDef.get(1).name == 'new title' assert FormDef.get(1).url_name == 'new-title' @@ -146,7 +146,7 @@ def test_form_category(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert 'Category:' not in resp.body Category.wipe() @@ -154,7 +154,7 @@ def test_form_category(): cat.store() cat = Category(name='Bar') cat.store() - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert 'Category:' in resp.body def test_form_category_select(): @@ -174,12 +174,12 @@ def test_form_category_select(): cat.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='category') resp = resp.forms[0].submit('cancel') assert FormDef.get(formdef.id).category_id is None - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='category') resp.forms[0]['category_id'] = cat.id resp = resp.forms[0].submit('submit') @@ -196,7 +196,7 @@ def test_form_workflow(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert 'Workflow:' not in resp.body Workflow.wipe() @@ -205,7 +205,7 @@ def test_form_workflow(): workflow = Workflow(name='Workflow Two') workflow.store() - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert 'Workflow:' in resp.body def test_form_workflow_change(): @@ -226,12 +226,12 @@ def test_form_workflow_change(): workflow.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='workflow') resp = resp.forms[0].submit('cancel') assert FormDef.get(formdef.id).workflow_id is None - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='workflow') assert 'Workflow One' not in resp.body # this workflow doesn't have any status resp.forms[0]['workflow_id'] = workflow.id @@ -263,11 +263,11 @@ def test_form_workflow_remapping(): workflow.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='workflow') resp.forms[0]['workflow_id'] = workflow.id resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/forms/1/workflow-status-remapping?new=2' + assert resp.location == 'http://example.net/backoffice/forms/1/workflow-status-remapping?new=2' resp = resp.follow() for status in Workflow.get_default_workflow().possible_status: assert resp.forms[0]['mapping-%s' % status.id] @@ -288,11 +288,11 @@ def test_form_workflow_role(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='role/_receiver') resp = resp.forms[0].submit('cancel') - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='role/_receiver') resp.forms[0]['role_id'] = 'foobar' resp = resp.forms[0].submit('submit') @@ -315,7 +315,7 @@ def test_form_workflow_options(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert '"workflow-options"' in resp.body def test_form_workflow_variables(): @@ -338,7 +338,7 @@ def test_form_workflow_variables(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert '"workflow-variables"' in resp.body # visit the variables page @@ -347,7 +347,7 @@ def test_form_workflow_variables(): # and set a value resp.forms[0]['f1'] = 'foobar' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/' + assert resp.location == 'http://example.net/backoffice/forms/1/' # check the value has been correctly saved assert FormDef.get(formdef.id).workflow_options == {'test': 'foobar'} @@ -358,7 +358,7 @@ def test_form_workflow_variables(): assert resp.forms[0]['f1'].value == 'foobar' resp.forms[0]['f1'] = 'barbaz' resp = resp.forms[0].submit('cancel') - assert resp.location == 'http://example.net/admin/forms/1/' + assert resp.location == 'http://example.net/backoffice/forms/1/' def test_form_acl_read(): create_superuser() @@ -371,11 +371,11 @@ def test_form_acl_read(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='acl-read') resp = resp.forms[0].submit('cancel') - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='acl-read') resp.forms[0]['acl_read'] = 'Everybody' resp = resp.forms[0].submit('submit') @@ -392,11 +392,11 @@ def test_form_roles(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='roles') resp = resp.forms[0].submit('cancel') - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click('change', href='roles') resp.forms[0]['always_advertise'] = True resp = resp.forms[0].submit('submit') @@ -412,11 +412,11 @@ def test_form_delete(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='delete') resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/' + assert resp.location == 'http://example.net/backoffice/forms/' resp = resp.follow() assert FormDef.count() == 0 @@ -430,17 +430,17 @@ def test_form_duplicate(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='duplicate') - assert resp.location == 'http://example.net/admin/forms/2/' + assert resp.location == 'http://example.net/backoffice/forms/2/' resp = resp.follow() assert FormDef.count() == 2 assert FormDef.get(2).name == 'form title (copy)' - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='duplicate') - assert resp.location == 'http://example.net/admin/forms/3/' + assert resp.location == 'http://example.net/backoffice/forms/3/' resp = resp.follow() assert FormDef.count() == 3 assert FormDef.get(3).name == 'form title (copy 2)' @@ -455,7 +455,7 @@ def test_form_export(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='export') xml_export = resp.body @@ -474,7 +474,7 @@ def test_form_qrcode(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='qrcode') assert '
' in resp.body @@ -490,13 +490,13 @@ def test_form_description(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert 'No description or keywords' in resp.body resp = resp.click(href='information') resp.forms[0]['description'].value = '

Hello World

' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/' + assert resp.location == 'http://example.net/backoffice/forms/1/' resp = resp.follow() assert 'No description or keywords' not in resp.body assert 'Hello World' in resp.body @@ -512,14 +512,14 @@ def test_form_new_field(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='fields/') assert 'There are not yet any fields for this form' in resp.body resp.forms[0]['label'] = 'foobar' resp.forms[0]['type'] = 'Text (line)' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/fields/' + assert resp.location == 'http://example.net/backoffice/forms/1/fields/' resp = resp.follow() assert 'foobar' in resp.body assert 'Use drag and drop to reorder fields.' in resp.body @@ -532,11 +532,11 @@ def test_form_new_field(): resp.forms[0]['label'] = 'baz' resp.forms[0]['type'] = 'Title' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/fields/' + assert resp.location == 'http://example.net/backoffice/forms/1/fields/' resp = resp.follow() # check it's in the preview - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') assert '

baz

' in resp.body def test_form_delete_field(): @@ -549,14 +549,14 @@ def test_form_delete_field(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='fields/') assert '1st field' in resp.body assert 'Use drag and drop to reorder fields.' in resp.body resp = resp.click(href='1/delete') resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/forms/1/fields/' + assert resp.location == 'http://example.net/backoffice/forms/1/fields/' resp = resp.follow() assert len(FormDef.get(1).fields) == 0 @@ -570,12 +570,12 @@ def test_form_duplicate_field(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='fields/') assert '1st field' in resp.body resp = resp.click(href='1/duplicate') - assert resp.location == 'http://example.net/admin/forms/1/fields/' + assert resp.location == 'http://example.net/backoffice/forms/1/fields/' resp = resp.follow() assert len(FormDef.get(1).fields) == 2 assert FormDef.get(1).fields[0].label == '1st field' @@ -591,7 +591,7 @@ def test_form_edit_field(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='fields/') assert '1st field' in resp.body @@ -600,7 +600,7 @@ def test_form_edit_field(): resp.forms[0]['label'] = 'changed field' resp.forms[0]['required'] = False resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/forms/1/fields/' + assert resp.location == 'http://example.net/backoffice/forms/1/fields/' assert FormDef.get(1).fields[0].label == 'changed field' assert FormDef.get(1).fields[0].required == False @@ -616,7 +616,7 @@ def test_form_edit_field_advanced(): formdef.store() app = login(get_app(pub)) - resp = app.get('/admin/forms/1/') + resp = app.get('/backoffice/forms/1/') resp = resp.click(href='fields/') assert '1st field' in resp.body @@ -639,7 +639,7 @@ def test_form_edit_field_advanced(): # complete it resp.forms[0]['prefill$value'] = 'test' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/forms/1/fields/' + assert resp.location == 'http://example.net/backoffice/forms/1/fields/' resp = resp.follow() assert FormDef.get(formdef.id).fields[0].prefill == {'type': 'string', 'value': 'test'} @@ -663,11 +663,11 @@ def test_form_edit_field_advanced(): def test_workflows(): app = login(get_app(pub)) - app.get('/admin/workflows/') + app.get('/backoffice/workflows/') def test_workflows_default(): app = login(get_app(pub)) - resp = app.get('/admin/workflows/') + resp = app.get('/backoffice/workflows/') assert 'Default' in resp.body resp = resp.click(href='_default') assert 'Just Submitted' in resp.body @@ -684,13 +684,13 @@ def test_workflows_default(): def test_workflows_new(): Workflow.wipe() app = login(get_app(pub)) - resp = app.get('/admin/workflows/') + resp = app.get('/backoffice/workflows/') # create a new workflow resp = resp.click('New Workflow') resp.forms[0]['name'] = 'a new workflow' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/workflows/1/' + assert resp.location == 'http://example.net/backoffice/workflows/1/' resp = resp.follow() assert 'There are not yet any status defined in this workflow' in resp.body assert not 'Number of filtered users: 1<' in resp.body assert 'user-is-admin' in resp.body # superuser assert 'foo bar 1' not in resp.body # simple user assert 'baz bar 1' not in resp.body # user with role - resp = app.get('/admin/users/?offset=0&limit=100&q=&filter=true&role=1') + resp = app.get('/backoffice/users/?offset=0&limit=100&q=&filter=true&role=1') assert '>Number of filtered users: 5<' in resp.body assert 'user-is-admin' not in resp.body # superuser assert 'foo bar 10' not in resp.body # simple user @@ -1071,7 +1071,7 @@ def test_users_search(): user.store() app = login(get_app(pub)) - resp = app.get('/admin/users/') + resp = app.get('/backoffice/users/') assert 'foo 10' in resp.body resp.forms[0]['q'] = 'bar' @@ -1082,17 +1082,17 @@ def test_users_search(): def test_roles(): app = login(get_app(pub)) - app.get('/admin/roles/') + app.get('/backoffice/roles/') def test_roles_new(): Role.wipe() app = login(get_app(pub)) - resp = app.get('/admin/roles/') + resp = app.get('/backoffice/roles/') resp = resp.click('New Role') resp.forms[0]['name'] = 'a new role' resp.forms[0]['details'] = 'bla bla bla' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/roles/' + assert resp.location == 'http://example.net/backoffice/roles/' resp = resp.follow() assert 'a new role' in resp.body resp = resp.click('a new role') @@ -1107,7 +1107,7 @@ def test_roles_edit(): role.store() app = login(get_app(pub)) - resp = app.get('/admin/roles/1/') + resp = app.get('/backoffice/roles/1/') assert 'Holders of this role are granted access to the backoffice' in resp.body resp = resp.click(href='edit') @@ -1116,7 +1116,7 @@ def test_roles_edit(): resp.forms[0]['details'] = 'bla bla bla' resp.forms[0]['emails_to_members'].checked = True resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/roles/1/' + assert resp.location == 'http://example.net/backoffice/roles/1/' resp = resp.follow() assert 'Role - baz' in resp.body assert 'Holders of this role will receive all emails adressed to the role.' in resp.body @@ -1131,7 +1131,7 @@ def test_roles_matching_formdefs(): FormDef.wipe() app = login(get_app(pub)) - resp = app.get('/admin/roles/1/') + resp = app.get('/backoffice/roles/1/') assert 'form bar' not in resp.body formdef = FormDef() @@ -1139,7 +1139,7 @@ def test_roles_matching_formdefs(): formdef.roles = [role.id] formdef.store() - resp = app.get('/admin/roles/1/') + resp = app.get('/backoffice/roles/1/') assert 'form bar' in resp.body assert 'form baz' not in resp.body @@ -1149,7 +1149,7 @@ def test_roles_matching_formdefs(): formdef.workflow_roles = {'_receiver': role.id} formdef.store() - resp = app.get('/admin/roles/1/') + resp = app.get('/backoffice/roles/1/') assert 'form baz' in resp.body assert 'form bar' not in resp.body @@ -1159,35 +1159,35 @@ def test_roles_delete(): role.store() app = login(get_app(pub)) - resp = app.get('/admin/roles/1/') + resp = app.get('/backoffice/roles/1/') resp = resp.click(href='delete') resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/roles/' + assert resp.location == 'http://example.net/backoffice/roles/' resp = resp.follow() assert Role.count() == 0 def test_categories(): app = login(get_app(pub)) - app.get('/admin/categories/') + app.get('/backoffice/categories/') def test_categories_new(): Category.wipe() app = login(get_app(pub)) # go to the page and cancel - resp = app.get('/admin/categories/') + resp = app.get('/backoffice/categories/') resp = resp.click('New Category') resp = resp.forms[0].submit('cancel') - assert resp.location == 'http://example.net/admin/categories/' + assert resp.location == 'http://example.net/backoffice/categories/' # go to the page and add a category - resp = app.get('/admin/categories/') + resp = app.get('/backoffice/categories/') resp = resp.click('New Category') resp.forms[0]['name'] = 'a new category' resp.forms[0]['description'] = 'description of the category' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/categories/' + assert resp.location == 'http://example.net/backoffice/categories/' resp = resp.follow() assert 'a new category' in resp.body resp = resp.click('a new category') @@ -1202,14 +1202,14 @@ def test_categories_edit(): category.store() app = login(get_app(pub)) - resp = app.get('/admin/categories/1/') + resp = app.get('/backoffice/categories/1/') assert 'no form associated to this category' in resp.body resp = resp.click(href='edit') assert resp.forms[0]['name'].value == 'foobar' resp.forms[0]['description'] = 'category description' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/categories/' + assert resp.location == 'http://example.net/backoffice/categories/' resp = resp.follow() resp = resp.click('foobar') assert 'Category - foobar' in resp.body @@ -1224,7 +1224,7 @@ def test_categories_edit_duplicate_name(): category.store() app = login(get_app(pub)) - resp = app.get('/admin/categories/1/') + resp = app.get('/backoffice/categories/1/') resp = resp.click(href='edit') assert resp.forms[0]['name'].value == 'foobar' @@ -1233,7 +1233,7 @@ def test_categories_edit_duplicate_name(): assert 'This name is already used' in resp.body resp = resp.forms[0].submit('cancel') - assert resp.location == 'http://example.net/admin/categories/' + assert resp.location == 'http://example.net/backoffice/categories/' def test_categories_with_formdefs(): Category.wipe() @@ -1242,7 +1242,7 @@ def test_categories_with_formdefs(): FormDef.wipe() app = login(get_app(pub)) - resp = app.get('/admin/categories/1/') + resp = app.get('/backoffice/categories/1/') assert 'form bar' not in resp.body formdef = FormDef() @@ -1250,7 +1250,7 @@ def test_categories_with_formdefs(): formdef.category_id = category.id formdef.store() - resp = app.get('/admin/categories/1/') + resp = app.get('/backoffice/categories/1/') assert 'form bar' in resp.body assert 'no form associated to this category' not in resp.body @@ -1261,17 +1261,17 @@ def test_categories_delete(): FormDef.wipe() app = login(get_app(pub)) - resp = app.get('/admin/categories/1/') + resp = app.get('/backoffice/categories/1/') resp = resp.click(href='delete') resp = resp.forms[0].submit('cancel') - assert resp.location == 'http://example.net/admin/categories/' + assert resp.location == 'http://example.net/backoffice/categories/' assert Category.count() == 1 - resp = app.get('/admin/categories/1/') + resp = app.get('/backoffice/categories/1/') resp = resp.click(href='delete') resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/categories/' + assert resp.location == 'http://example.net/backoffice/categories/' resp = resp.follow() assert Category.count() == 0 @@ -1285,18 +1285,18 @@ def test_categories_edit_description(): app = login(get_app(pub)) # this URL is used for editing from the frontoffice, there's no link # pointing to it in the admin. - resp = app.get('/admin/categories/1/description') + resp = app.get('/backoffice/categories/1/description') assert resp.forms[0]['description'].value == 'category description' resp.forms[0]['description'] = 'updated description' # check cancel doesn't save the change resp2 = resp.forms[0].submit('cancel') - assert resp2.location == 'http://example.net/admin/categories/1/' + assert resp2.location == 'http://example.net/backoffice/categories/1/' assert Category.get(1).description == 'category description' # check submit does it properly resp2 = resp.forms[0].submit('submit') - assert resp2.location == 'http://example.net/admin/categories/1/' + assert resp2.location == 'http://example.net/backoffice/categories/1/' resp2 = resp2.follow() assert Category.get(1).description == 'updated description' @@ -1306,7 +1306,7 @@ def test_categories_new_duplicate_name(): category.store() app = login(get_app(pub)) - resp = app.get('/admin/categories/') + resp = app.get('/backoffice/categories/') resp = resp.click('New Category') resp.forms[0]['name'] = 'foobar' resp = resp.forms[0].submit('submit') @@ -1322,30 +1322,30 @@ def test_categories_reorder(): category.store() app = login(get_app(pub)) - resp = app.get('/admin/categories/update_order?order=1;2;3;') + resp = app.get('/backoffice/categories/update_order?order=1;2;3;') categories = Category.select() Category.sort_by_position(categories) assert [x.id for x in categories] == [1, 2, 3] - resp = app.get('/admin/categories/update_order?order=3;1;2;') + resp = app.get('/backoffice/categories/update_order?order=3;1;2;') categories = Category.select() Category.sort_by_position(categories) assert [x.id for x in categories] == [3, 1, 2] def test_settings(): app = login(get_app(pub)) - app.get('/admin/settings/') + app.get('/backoffice/settings/') - app.get('/admin/settings/misc') - app.get('/admin/settings/debug_options') - app.get('/admin/settings/language') - app.get('/admin/settings/import') - app.get('/admin/settings/export') - app.get('/admin/settings/identification') - app.get('/admin/settings/sitename') - app.get('/admin/settings/sms') - app.get('/admin/settings/session') - app.get('/admin/settings/admin-permissions') + app.get('/backoffice/settings/misc') + app.get('/backoffice/settings/debug_options') + app.get('/backoffice/settings/language') + app.get('/backoffice/settings/import') + app.get('/backoffice/settings/export') + app.get('/backoffice/settings/identification') + app.get('/backoffice/settings/sitename') + app.get('/backoffice/settings/sms') + app.get('/backoffice/settings/session') + app.get('/backoffice/settings/admin-permissions') def test_settings_themes(): @@ -1362,28 +1362,28 @@ def test_settings_themes(): '') fd.close() - resp = app.get('/admin/settings/themes') + resp = app.get('/backoffice/settings/themes') assert 'biglist themes' in resp.body assert 'Test Theme (1.0)' in resp.body # just for the kick, there's no support for uploading file in webtest 1.3 - resp = app.get('/admin/settings/themes') + resp = app.get('/backoffice/settings/themes') resp.click('Install New Theme') # select the theme - resp = app.get('/admin/settings/themes') + resp = app.get('/backoffice/settings/themes') resp.forms[0]['theme'].value = 'test' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/settings/' + assert resp.location == 'http://example.net/backoffice/settings/' - resp = app.get('/admin/settings/themes') + resp = app.get('/backoffice/settings/themes') assert 'checked' in resp.body assert get_current_theme()['name'] == 'test' def test_settings_template(): create_superuser() app = login(get_app(pub)) - resp = app.get('/admin/settings/template') + resp = app.get('/backoffice/settings/template') # change template orig_value = resp.forms[0]['template'].value @@ -1392,23 +1392,23 @@ def test_settings_template(): resp = resp.forms[0].submit('submit') # restore default template - resp = app.get('/admin/settings/template') + resp = app.get('/backoffice/settings/template') assert 'foobar' in resp.forms[0]['template'].value resp = resp.forms[0].submit('restore-default') # check - resp = app.get('/admin/settings/template') + resp = app.get('/backoffice/settings/template') assert resp.forms[0]['template'].value == orig_value def test_settings_user(): create_superuser() app = login(get_app(pub)) - resp = app.get('/admin/settings/users').follow().follow() + resp = app.get('/backoffice/settings/users').follow().follow() # add a field resp.forms[1]['label'] = 'foobar' resp = resp.forms[1].submit() - assert resp.location == 'http://example.net/admin/settings/users/fields/' + assert resp.location == 'http://example.net/backoffice/settings/users/fields/' resp = resp.follow() assert 'foobar' in pub.cfg['users']['formdef'] assert 'foobar' in resp.body @@ -1416,14 +1416,14 @@ def test_settings_user(): # set field as email resp.forms[0]['field_email'] = '1' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/settings/users/fields/' + assert resp.location == 'http://example.net/backoffice/settings/users/fields/' resp = resp.follow() assert pub.cfg['users']['field_email'] == '1' # and unset it resp.forms[0]['field_email'] = '' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/settings/users/fields/' + assert resp.location == 'http://example.net/backoffice/settings/users/fields/' resp = resp.follow() assert pub.cfg['users']['field_email'] == None @@ -1431,13 +1431,13 @@ def test_settings_user(): resp.forms[1]['label'] = 'barfoo' resp.forms[1]['type'] = 'Comment' resp = resp.forms[1].submit() - assert resp.location == 'http://example.net/admin/settings/users/fields/' + assert resp.location == 'http://example.net/backoffice/settings/users/fields/' resp = resp.follow() assert 'barfoo' in pub.cfg['users']['formdef'] assert 'barfoo' in resp.body # check fields are present in edit form - resp = app.get('/admin/users/admin/edit') + resp = app.get('/backoffice/users/admin/edit') assert 'barfoo' in resp.body assert 'f1' in resp.forms[0].fields assert 'email' in resp.forms[0].fields @@ -1446,7 +1446,7 @@ def test_settings_user(): # field. pub.cfg['users']['field_email'] = '1' pub.write_cfg() - resp = app.get('/admin/users/admin/edit') + resp = app.get('/backoffice/users/admin/edit') assert 'f1' in resp.forms[0].fields assert 'email' not in resp.forms[0].fields @@ -1460,17 +1460,17 @@ def test_settings_emails(): pub.cfg['debug'] = {'mail_redirection': 'foo@example.net'} pub.write_cfg() - resp = app.get('/admin/settings/emails/') + resp = app.get('/backoffice/settings/emails/') resp = resp.click('General Options') assert 'Warning: all emails are sent to <foo@example.net>' in resp.body pub.cfg['debug'] = {} pub.write_cfg() - resp = app.get('/admin/settings/emails/') + resp = app.get('/backoffice/settings/emails/') resp = resp.click('General Options') assert 'Warning: all emails are sent to <foo@example.net>' not in resp.body - resp = app.get('/admin/settings/emails/') + resp = app.get('/backoffice/settings/emails/') resp = resp.click('Approval of new account') resp.forms[0]['email-new-account-approved_subject'] = 'bla' resp.forms[0]['email-new-account-approved'] = 'bla bla bla' @@ -1479,7 +1479,7 @@ def test_settings_emails(): assert pub.cfg['emails']['email-new-account-approved'] == 'bla bla bla' # reset to default value - resp = app.get('/admin/settings/emails/') + resp = app.get('/backoffice/settings/emails/') resp = resp.click('Approval of new account') resp.forms[0]['email-new-account-approved_subject'] = 'Your account has been approved' resp = resp.forms[0].submit() @@ -1489,17 +1489,17 @@ def test_settings_texts(): create_superuser() app = login(get_app(pub)) - resp = app.get('/admin/settings/texts/') + resp = app.get('/backoffice/settings/texts/') resp = resp.click('Text on top of the login page') resp.forms[0]['text-top-of-login'] = 'Hello world' resp = resp.forms[0].submit() - assert resp.location == 'http://example.net/admin/settings/texts/' + assert resp.location == 'http://example.net/backoffice/settings/texts/' assert pub.cfg['texts']['text-top-of-login'] == 'Hello world' - resp = app.get('/admin/settings/texts/') + resp = app.get('/backoffice/settings/texts/') resp = resp.click('Text on top of the login page') resp = resp.forms[0].submit('restore-default') - assert resp.location == 'http://example.net/admin/settings/texts/' + assert resp.location == 'http://example.net/backoffice/settings/texts/' assert pub.cfg['texts']['text-top-of-login'] == None @pytest.mark.skipif('lasso is None') @@ -1509,7 +1509,7 @@ def test_settings_auth(): pub.write_cfg() app = get_app(pub) - resp = app.get('/admin/settings/') + resp = app.get('/backoffice/settings/') assert not 'identification/password/' in resp.body assert not 'identification/idp/' in resp.body @@ -1539,7 +1539,7 @@ def test_settings_idp(): pub.write_cfg() app = get_app(pub) app.get('/saml/metadata', status=404) - resp = app.get('/admin/settings/') + resp = app.get('/backoffice/settings/') resp = resp.click(href='identification/idp/') resp = resp.click('Service Provider') resp = resp.forms[0].submit() @@ -1564,7 +1564,7 @@ def test_settings_idp(): login_resp = app.get('/login/', status=302) assert login_resp.location.startswith('http://sso.example.net/saml2/sso?SAMLRequest') - resp = resp.click(href='/admin/settings/identification/idp/idp/') # breadcrumb + resp = resp.click(href='/backoffice/settings/identification/idp/idp/') # breadcrumb resp = resp.click(href='http-sso.example.net-saml2-metadata/delete') resp = resp.forms[0].submit() # confirm delete assert len(pub.cfg['idp']) == 0 @@ -1573,12 +1573,12 @@ def test_settings_filetypes(): create_superuser() app = login(get_app(pub)) - resp = app.get('/admin/settings/filetypes/') + resp = app.get('/backoffice/settings/filetypes/') assert 'There are no file type defined at the moment.' in resp.body resp.forms[0]['label'] = 'Text files' resp.forms[0]['mimetypes'] = '.odt' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/settings/filetypes/' + assert resp.location == 'http://example.net/backoffice/settings/filetypes/' resp = resp.follow() assert pub.cfg['filetypes'][1]['label'] == 'Text files' @@ -1586,7 +1586,7 @@ def test_settings_filetypes(): assert resp.forms[0]['mimetypes'].value == 'application/vnd.oasis.opendocument.text' resp.forms[0]['mimetypes'] = 'application/vnd.oasis.opendocument.text, .doc, .docx, .pdf' resp = resp.forms[0].submit('submit') - assert resp.location == 'http://example.net/admin/settings/filetypes/' + assert resp.location == 'http://example.net/backoffice/settings/filetypes/' resp = resp.follow() assert 'application/msword (.doc)' in resp.body assert 'application/pdf' in pub.cfg['filetypes'][1]['mimetypes'] @@ -1597,13 +1597,13 @@ def test_settings_filetypes(): resp = resp.follow() resp = resp.click('HTML files') # go to form resp = resp.forms[0].submit('cancel') # and cancel - assert resp.location == 'http://example.net/admin/settings/filetypes/' + assert resp.location == 'http://example.net/backoffice/settings/filetypes/' resp = resp.follow() assert 'HTML files' in resp.body resp = resp.click('HTML files') # go to form resp = resp.forms[0].submit('delete') # and delete - assert resp.location == 'http://example.net/admin/settings/filetypes/' + assert resp.location == 'http://example.net/backoffice/settings/filetypes/' resp = resp.follow() assert 'HTML files' not in resp.body @@ -1616,7 +1616,7 @@ def test_settings_filetypes_update(): 'label': 'Text files'} } pub.write_cfg() - resp = app.get('/admin/settings/filetypes/') + resp = app.get('/backoffice/settings/filetypes/') assert 'Text files' in resp.body FormDef.wipe() -- 2.1.4