Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
Hsin-Yu Chien
edx-platform-release
Commits
bac070e8
Commit
bac070e8
authored
5 years ago
by
Kyle McCormick
Committed by
Kyle McCormick
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fixup! fixup! Handle next and course_id in /login_ajax
nvm, just skip_unless_lms
parent
0875ede9
No related branches found
Branches containing commit
Tags
release-2021-06-07-11.14
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/core/djangoapps/user_authn/views/tests/test_login.py
+5
-16
5 additions, 16 deletions
openedx/core/djangoapps/user_authn/views/tests/test_login.py
with
5 additions
and
16 deletions
openedx/core/djangoapps/user_authn/views/tests/test_login.py
+
5
−
16
View file @
bac070e8
...
...
@@ -87,7 +87,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
{
'
next_url
'
:
None
,
'
course_id
'
:
None
,
'
expected_redirect
'
:
'
/
homepage-placeholder
'
,
'
expected_redirect
'
:
'
/
dashboard
'
,
},
# A relative path is an acceptable redirect.
{
...
...
@@ -105,7 +105,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
{
'
next_url
'
:
'
https://evil.sketchysite
'
,
'
course_id
'
:
None
,
'
expected_redirect
'
:
'
/
homepage-placeholder
'
,
'
expected_redirect
'
:
'
/
dashboard
'
,
},
# An absolute URL to a whitelisted domain is acceptable.
{
...
...
@@ -118,7 +118,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
'
next_url
'
:
None
,
'
course_id
'
:
'
coursekey
'
,
'
expected_redirect
'
:
(
'
/account/finish_auth?course_id=coursekey&next=%2F
homepage-placeholder
'
'
/account/finish_auth?course_id=coursekey&next=%2F
dashboard
'
),
},
# If valid course_id AND next_url are provided, redirect to finish_auth with
...
...
@@ -136,26 +136,15 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
'
next_url
'
:
'
http://scam.scam
'
,
'
course_id
'
:
'
coursekey
'
,
'
expected_redirect
'
:
(
'
/account/finish_auth?course_id=coursekey&next=%2F
homepage-placeholder
'
'
/account/finish_auth?course_id=coursekey&next=%2F
dashboard
'
),
},
)
@ddt.unpack
@override_settings
(
LOGIN_REDIRECT_WHITELIST
=
[
'
openedx.service
'
])
@override_settings
(
FEATURES
=
FEATURES_WITH_LOGIN_MFE_ENABLED
)
@patch
(
# Mock out reverse for LMS and Studio default redirects
# (/dashboard and /home, respectively).
# That way, we can handle both cases, while also making it easier to change this
# test if the default LMS redirect ever changes.
'
student.helpers.reverse
'
,
lambda
urlname
,
*
args
,
**
kwargs
:
(
'
/homepage-placeholder
'
if
urlname
in
{
'
dashboard
'
,
'
home
'
}
else
reverse
(
urlname
)
)
)
@skip_unless_lms
def
test_login_success_with_redirect
(
self
,
next_url
,
course_id
,
expected_redirect
):
# Default redirect is student dashboard.
post_params
=
{}
if
next_url
:
post_params
[
'
next
'
]
=
next_url
...
...
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