Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-basetheme-bootstrap
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bryan BRANCOTTE
django-basetheme-bootstrap
Commits
4ef943e6
Commit
4ef943e6
authored
4 years ago
by
Bryan BRANCOTTE
Browse files
Options
Downloads
Patches
Plain Diff
auto enable superuser account, even when email validation is mandatory
parent
43b50f6b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#38945
failed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
basetheme_bootstrap/tests.py
+19
-0
19 additions, 0 deletions
basetheme_bootstrap/tests.py
with
19 additions
and
0 deletions
basetheme_bootstrap/tests.py
+
19
−
0
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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment