From ef230dfc9c8b2d889c02df7e8375c329164cd17d Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Tue, 18 Jun 2019 20:36:26 +0200 Subject: [PATCH] tests: test users API with send_registration_email_next_url (#34115) --- tests/test_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_api.py b/tests/test_api.py index cf3be3cb..5680d204 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -565,6 +565,7 @@ def test_api_users_create_send_mail(app, settings, superuser): # Use case is often that Email is the main identifier settings.A2_EMAIL_IS_UNIQUE = True + settings.A2_REDIRECT_WHITELIST = ['http://example.com'] Attribute.objects.create(kind='title', name='title', label='title') app.authorization = ('Basic', (superuser.username, superuser.username)) @@ -575,6 +576,7 @@ def test_api_users_create_send_mail(app, settings, superuser): 'email': 'john.doe@example.net', 'title': 'Mr', 'send_registration_email': True, + 'send_registration_email_next_url': 'http://example.com/', } assert len(mail.outbox) == 0 resp = app.post_json('/api/users/', params=payload, status=201) @@ -586,9 +588,10 @@ def test_api_users_create_send_mail(app, settings, superuser): resp = app.get(relative_url, status=200) resp.form.set('new_password1', '1234==aA') resp.form.set('new_password2', '1234==aA') - resp = resp.form.submit().follow() + resp = resp.form.submit() # Check user was properly logged in assert str(app.session['_auth_user_id']) == str(user_id) + assert resp.location == 'http://example.com/' def test_api_users_create_force_password_reset(app, client, settings, superuser): -- 2.20.1