Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bryan BRANCOTTE
django-basetheme-bootstrap
Commits
4ef943e6
Commit
4ef943e6
authored
Oct 05, 2020
by
Bryan BRANCOTTE
Browse files
auto enable superuser account, even when email validation is mandatory
parent
43b50f6b
Pipeline
#38945
failed with stage
in 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
basetheme_bootstrap/tests.py
View file @
4ef943e6
...
@@ -200,6 +200,7 @@ class SignUpWithValidationTests(TestCase):
...
@@ -200,6 +200,7 @@ class SignUpWithValidationTests(TestCase):
self
.
assertEqual
(
len
(
m
),
1
)
self
.
assertEqual
(
len
(
m
),
1
)
def
test_activate_too_late_with_user_pending_resend_email
(
self
):
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
actual_account_activation_token
=
tokens
.
account_activation_token
class
MockedTokenGenerator
(
tokens
.
TokenGenerator
):
class
MockedTokenGenerator
(
tokens
.
TokenGenerator
):
...
@@ -253,6 +254,24 @@ class TestWithTemplatesInPlace(SignUpTests):
...
@@ -253,6 +254,24 @@ class TestWithTemplatesInPlace(SignUpTests):
os
.
remove
(
t
)
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
):
class
SuperuserSignUpTests
(
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment