Commit 4ef943e6 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

auto enable superuser account, even when email validation is mandatory

parent 43b50f6b
Pipeline #38945 failed with stage
in 51 seconds
......@@ -200,6 +200,7 @@ class SignUpWithValidationTests(TestCase):
self.assertEqual(len(m), 1)
def test_activate_too_late_with_user_pending_resend_email(self):
get_user_model().objects.create(username="toto")
actual_account_activation_token = tokens.account_activation_token
class MockedTokenGenerator(tokens.TokenGenerator):
......@@ -253,6 +254,24 @@ class TestWithTemplatesInPlace(SignUpTests):
os.remove(t)
@override_settings(
BASETHEME_BOOTSTRAP_VALIDATE_EMAIL_BEFORE_ACTIVATION=True,
)
class SuperuserSignUpTests(TestCase):
def test_sign_up_for_superuser(self):
#even with BASETHEME_BOOTSTRAP_VALIDATE_EMAIL_BEFORE_ACTIVATION to True first user must be super and active
response = self.client.post(reverse('basetheme_bootstrap:signup'), {
'username': "userAAA",
'email': "bryan.brancotte@pasteur.fr",
'password1': "user@mp.comuser@mp.comuser@mp.comuser@mp.com",
'password2': "user@mp.comuser@mp.comuser@mp.comuser@mp.com",
'first_name': "user"
})
self.assertEqual(response.status_code, 302)
self.assertTrue(get_user_model().objects.get(username="userAAA").is_superuser)
self.assertTrue(get_user_model().objects.get(username="userAAA").is_active)
class SuperuserSignUpTests(TestCase):
def setUp(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