fixup! fixup! Handle next and course_id in /login_ajax

nvm, just skip_unless_lms
This commit is contained in:
Kyle McCormick
2020-02-13 11:01:24 -05:00
committed by Kyle McCormick
parent 0875ede96f
commit bac070e8af

View File

@@ -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=%2Fhomepage-placeholder'
'/account/finish_auth?course_id=coursekey&next=%2Fdashboard'
),
},
# 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=%2Fhomepage-placeholder'
'/account/finish_auth?course_id=coursekey&next=%2Fdashboard'
),
},
)
@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