Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
beat.web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
54
Issues
54
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
beat
beat.web
Commits
0785f3d6
Commit
0785f3d6
authored
Sep 24, 2020
by
Samuel GAIST
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ui][test][views] Refactor the test to avoid hard coded URL
parent
ccb73abd
Pipeline
#43058
passed with stage
in 15 minutes and 31 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
beat/web/ui/test_views.py
beat/web/ui/test_views.py
+12
-6
No files found.
beat/web/ui/test_views.py
View file @
0785f3d6
...
...
@@ -39,17 +39,24 @@ class EmailSendingTestCase(ViewTestCase):
def
setUp
(
self
):
super
().
setUp
()
def
run_email_check
(
self
,
reference_url
):
def
run_email_check
(
self
,
prefix
):
client
=
Client
()
response
=
client
.
post
(
reverse
(
"login"
),
dict
(
username
=
self
.
blockeduser
,
password
=
self
.
password
)
)
# logged_in = self.client.login(username=self.blockeduser, password=self.password)
reference_url
=
response
.
wsgi_request
.
build_absolute_uri
(
reverse
(
"blocked_user_reactivation"
)
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
len
(
mail
.
outbox
),
1
)
text_lines
=
mail
.
outbox
[
0
].
body
.
split
(
"
\
n
"
)
self
.
assertEqual
(
text_lines
[
-
4
],
reference_url
)
generated_url
=
text_lines
[
-
4
]
self
.
assertTrue
(
prefix
in
generated_url
)
self
.
assertURLEqual
(
generated_url
,
reference_url
)
def
test_email_for_blocked_account_login
(
self
):
for
prefix
in
[
""
,
"/platform"
]:
...
...
@@ -57,6 +64,5 @@ class EmailSendingTestCase(ViewTestCase):
mail
.
outbox
=
[]
with
override_settings
(
URL_PREFIX
=
prefix
):
reload_urlconf
()
self
.
run_email_check
(
"http://testserver"
+
prefix
+
"/blocked_user_reactivation/"
)
self
.
run_email_check
(
prefix
)
Write
Preview
Markdown
is supported
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