Commit 4ae3fad1 authored by Michal Čihař's avatar Michal Čihař

Add test for double registration from same browser

This currently fails due to reusing same session.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 4c97fa9c
......@@ -118,6 +118,45 @@ class RegistrationTest(TestCase, RegistrationTestMixin):
# Verify stored first/last name
self.assertEqual(user.first_name, 'First Last')
@OverrideSettings(REGISTRATION_OPEN=True)
@OverrideSettings(REGISTRATION_CAPTCHA=False)
def test_double_register(self):
"""Test double registration from single browser"""
# First registration
response = self.client.post(
reverse('register'),
REGISTRATION_DATA
)
first_url = self.assert_registration_mailbox()
mail.outbox.pop()
# Second registration
data = REGISTRATION_DATA.copy()
data['email'] = 'noreply@example.net'
data['username'] = 'second'
response = self.client.post(
reverse('register'),
data,
)
second_url = self.assert_registration_mailbox()
mail.outbox.pop()
# Confirm first account
response = self.client.get(first_url, follow=True)
self.assertRedirects(
response,
reverse('password')
)
self.client.get(reverse('logout'))
# Confirm second account
response = self.client.get(second_url, follow=True)
self.assertRedirects(
response,
reverse('password')
)
@OverrideSettings(REGISTRATION_OPEN=True)
@OverrideSettings(REGISTRATION_CAPTCHA=False)
def test_register_missing(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment