743 |
743 |
|
744 |
744 |
|
745 |
745 |
def test_manager_create_user_next(superuser_or_admin, app, ou1):
|
746 |
|
next_url = u'https://example.nowhere.null/'
|
|
746 |
next_url = u'/example.nowhere.null/'
|
747 |
747 |
url = u'/manage/users/%s/add/?next=%s' % (ou1.pk, next_url)
|
748 |
748 |
login(app, superuser_or_admin, '/manage/')
|
749 |
749 |
response = app.get(url)
|
750 |
|
form = response.form
|
751 |
|
form.set('first_name', 'John')
|
752 |
|
form.set('last_name', 'Doe')
|
753 |
|
form.set('email', 'john.doe@gmail.com')
|
754 |
|
form.set('password1', 'ABcd1234')
|
755 |
|
form.set('password2', 'ABcd1234')
|
756 |
|
assert form.submit().location == next_url
|
757 |
750 |
|
|
751 |
# cancel if not handled through form submission
|
|
752 |
assert response.pyquery.remove_namespaces()('a.cancel').attr('href') == next_url
|
758 |
753 |
|
759 |
|
def test_manager_create_user_next_form_cancelation(superuser_or_admin, app, ou1):
|
760 |
|
next_url = u'https://example.nowhere.null/'
|
761 |
|
url = u'/manage/users/%s/add/?next=%s' % (ou1.pk, next_url)
|
762 |
|
login(app, superuser_or_admin, '/manage/')
|
763 |
|
response = app.get(url)
|
764 |
754 |
form = response.form
|
765 |
755 |
form.set('first_name', 'John')
|
766 |
756 |
form.set('last_name', 'Doe')
|
767 |
757 |
form.set('email', 'john.doe@gmail.com')
|
768 |
758 |
form.set('password1', 'ABcd1234')
|
769 |
759 |
form.set('password2', 'ABcd1234')
|
770 |
|
assert form.submit('cancel').location == next_url
|
|
760 |
assert form.submit().location == next_url
|
771 |
761 |
|
772 |
762 |
|
773 |
763 |
def test_manager_create_user_next_form_error(superuser_or_admin, app, ou1):
|
774 |
|
next_url = u'https://example.nowhere.null/'
|
|
764 |
next_url = u'/example.nowhere.null/'
|
775 |
765 |
url = u'/manage/users/%s/add/?next=%s' % (ou1.pk, next_url)
|
776 |
766 |
login(app, superuser_or_admin, '/manage/')
|
777 |
767 |
response = app.get(url)
|
778 |
|
-
|