Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
cd69ca2b
Commit
cd69ca2b
authored
Aug 28, 2015
by
Tasawer
Committed by
Tasawer Nawaz
Aug 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unused url endpoints + fixed broken tests
ECOM-1017
parent
ab2d0063
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
55 deletions
+24
-55
common/djangoapps/third_party_auth/pipeline.py
+3
-26
common/djangoapps/third_party_auth/tests/specs/base.py
+0
-6
lms/djangoapps/student_account/test/test_views.py
+21
-21
lms/djangoapps/student_account/urls.py
+0
-2
No files found.
common/djangoapps/third_party_auth/pipeline.py
View file @
cd69ca2b
...
@@ -99,13 +99,6 @@ AUTH_ENTRY_LOGIN = 'login'
...
@@ -99,13 +99,6 @@ AUTH_ENTRY_LOGIN = 'login'
AUTH_ENTRY_REGISTER
=
'register'
AUTH_ENTRY_REGISTER
=
'register'
AUTH_ENTRY_ACCOUNT_SETTINGS
=
'account_settings'
AUTH_ENTRY_ACCOUNT_SETTINGS
=
'account_settings'
# This is left-over from an A/B test
# of the new combined login/registration page (ECOM-369)
# We need to keep both the old and new entry points
# until every session from before the test ended has expired.
AUTH_ENTRY_LOGIN_2
=
'account_login'
AUTH_ENTRY_REGISTER_2
=
'account_register'
# Entry modes into the authentication process by a remote API call (as opposed to a browser session).
# Entry modes into the authentication process by a remote API call (as opposed to a browser session).
AUTH_ENTRY_LOGIN_API
=
'login_api'
AUTH_ENTRY_LOGIN_API
=
'login_api'
AUTH_ENTRY_REGISTER_API
=
'register_api'
AUTH_ENTRY_REGISTER_API
=
'register_api'
...
@@ -126,28 +119,12 @@ AUTH_DISPATCH_URLS = {
...
@@ -126,28 +119,12 @@ AUTH_DISPATCH_URLS = {
AUTH_ENTRY_LOGIN
:
'/login'
,
AUTH_ENTRY_LOGIN
:
'/login'
,
AUTH_ENTRY_REGISTER
:
'/register'
,
AUTH_ENTRY_REGISTER
:
'/register'
,
AUTH_ENTRY_ACCOUNT_SETTINGS
:
'/account/settings'
,
AUTH_ENTRY_ACCOUNT_SETTINGS
:
'/account/settings'
,
# This is left-over from an A/B test
# of the new combined login/registration page (ECOM-369)
# We need to keep both the old and new entry points
# until every session from before the test ended has expired.
AUTH_ENTRY_LOGIN_2
:
'/account/login/'
,
AUTH_ENTRY_REGISTER_2
:
'/account/register/'
,
}
}
_AUTH_ENTRY_CHOICES
=
frozenset
([
_AUTH_ENTRY_CHOICES
=
frozenset
([
AUTH_ENTRY_LOGIN
,
AUTH_ENTRY_LOGIN
,
AUTH_ENTRY_REGISTER
,
AUTH_ENTRY_REGISTER
,
AUTH_ENTRY_ACCOUNT_SETTINGS
,
AUTH_ENTRY_ACCOUNT_SETTINGS
,
# This is left-over from an A/B test
# of the new combined login/registration page (ECOM-369)
# We need to keep both the old and new entry points
# until every session from before the test ended has expired.
AUTH_ENTRY_LOGIN_2
,
AUTH_ENTRY_REGISTER_2
,
AUTH_ENTRY_LOGIN_API
,
AUTH_ENTRY_LOGIN_API
,
AUTH_ENTRY_REGISTER_API
,
AUTH_ENTRY_REGISTER_API
,
])
])
...
@@ -508,13 +485,13 @@ def ensure_user_information(strategy, auth_entry, backend=None, user=None, socia
...
@@ -508,13 +485,13 @@ def ensure_user_information(strategy, auth_entry, backend=None, user=None, socia
if
not
user
:
if
not
user
:
if
auth_entry
in
[
AUTH_ENTRY_LOGIN_API
,
AUTH_ENTRY_REGISTER_API
]:
if
auth_entry
in
[
AUTH_ENTRY_LOGIN_API
,
AUTH_ENTRY_REGISTER_API
]:
return
HttpResponseBadRequest
()
return
HttpResponseBadRequest
()
elif
auth_entry
in
[
AUTH_ENTRY_LOGIN
,
AUTH_ENTRY_LOGIN_2
]
:
elif
auth_entry
==
AUTH_ENTRY_LOGIN
:
# User has authenticated with the third party provider but we don't know which edX
# User has authenticated with the third party provider but we don't know which edX
# account corresponds to them yet, if any.
# account corresponds to them yet, if any.
if
should_force_account_creation
():
if
should_force_account_creation
():
return
dispatch_to_register
()
return
dispatch_to_register
()
return
dispatch_to_login
()
return
dispatch_to_login
()
elif
auth_entry
in
[
AUTH_ENTRY_REGISTER
,
AUTH_ENTRY_REGISTER_2
]
:
elif
auth_entry
==
AUTH_ENTRY_REGISTER
:
# User has authenticated with the third party provider and now wants to finish
# User has authenticated with the third party provider and now wants to finish
# creating their edX account.
# creating their edX account.
return
dispatch_to_register
()
return
dispatch_to_register
()
...
@@ -603,7 +580,7 @@ def login_analytics(strategy, auth_entry, *args, **kwargs):
...
@@ -603,7 +580,7 @@ def login_analytics(strategy, auth_entry, *args, **kwargs):
""" Sends login info to Segment.io """
""" Sends login info to Segment.io """
event_name
=
None
event_name
=
None
if
auth_entry
in
[
AUTH_ENTRY_LOGIN
,
AUTH_ENTRY_LOGIN_2
]
:
if
auth_entry
==
AUTH_ENTRY_LOGIN
:
event_name
=
'edx.bi.user.account.authenticated'
event_name
=
'edx.bi.user.account.authenticated'
elif
auth_entry
in
[
AUTH_ENTRY_ACCOUNT_SETTINGS
]:
elif
auth_entry
in
[
AUTH_ENTRY_ACCOUNT_SETTINGS
]:
event_name
=
'edx.bi.user.account.linked'
event_name
=
'edx.bi.user.account.linked'
...
...
common/djangoapps/third_party_auth/tests/specs/base.py
View file @
cd69ca2b
...
@@ -381,12 +381,6 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
...
@@ -381,12 +381,6 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
def
test_canceling_authentication_redirects_to_register_when_auth_entry_register
(
self
):
def
test_canceling_authentication_redirects_to_register_when_auth_entry_register
(
self
):
self
.
assert_exception_redirect_looks_correct
(
'/register'
,
auth_entry
=
pipeline
.
AUTH_ENTRY_REGISTER
)
self
.
assert_exception_redirect_looks_correct
(
'/register'
,
auth_entry
=
pipeline
.
AUTH_ENTRY_REGISTER
)
def
test_canceling_authentication_redirects_to_login_when_auth_login_2
(
self
):
self
.
assert_exception_redirect_looks_correct
(
'/account/login/'
,
auth_entry
=
pipeline
.
AUTH_ENTRY_LOGIN_2
)
def
test_canceling_authentication_redirects_to_login_when_auth_register_2
(
self
):
self
.
assert_exception_redirect_looks_correct
(
'/account/register/'
,
auth_entry
=
pipeline
.
AUTH_ENTRY_REGISTER_2
)
def
test_canceling_authentication_redirects_to_account_settings_when_auth_entry_account_settings
(
self
):
def
test_canceling_authentication_redirects_to_account_settings_when_auth_entry_account_settings
(
self
):
self
.
assert_exception_redirect_looks_correct
(
self
.
assert_exception_redirect_looks_correct
(
'/account/settings'
,
auth_entry
=
pipeline
.
AUTH_ENTRY_ACCOUNT_SETTINGS
'/account/settings'
,
auth_entry
=
pipeline
.
AUTH_ENTRY_ACCOUNT_SETTINGS
...
...
lms/djangoapps/student_account/test/test_views.py
View file @
cd69ca2b
...
@@ -217,8 +217,8 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -217,8 +217,8 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self
.
configure_facebook_provider
(
enabled
=
True
)
self
.
configure_facebook_provider
(
enabled
=
True
)
@ddt.data
(
@ddt.data
(
(
"
account_login
"
,
"login"
),
(
"
signin_user
"
,
"login"
),
(
"
account_regist
er"
,
"register"
),
(
"
register_us
er"
,
"register"
),
)
)
@ddt.unpack
@ddt.unpack
def
test_login_and_registration_form
(
self
,
url_name
,
initial_mode
):
def
test_login_and_registration_form
(
self
,
url_name
,
initial_mode
):
...
@@ -226,7 +226,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -226,7 +226,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
expected_data
=
u"data-initial-mode=
\"
{mode}
\"
"
.
format
(
mode
=
initial_mode
)
expected_data
=
u"data-initial-mode=
\"
{mode}
\"
"
.
format
(
mode
=
initial_mode
)
self
.
assertContains
(
response
,
expected_data
)
self
.
assertContains
(
response
,
expected_data
)
@ddt.data
(
"
account_login"
,
"account_regist
er"
)
@ddt.data
(
"
signin_user"
,
"register_us
er"
)
def
test_login_and_registration_form_already_authenticated
(
self
,
url_name
):
def
test_login_and_registration_form_already_authenticated
(
self
,
url_name
):
# Create/activate a new account and log in
# Create/activate a new account and log in
activation_key
=
create_account
(
self
.
USERNAME
,
self
.
PASSWORD
,
self
.
EMAIL
)
activation_key
=
create_account
(
self
.
USERNAME
,
self
.
PASSWORD
,
self
.
EMAIL
)
...
@@ -239,10 +239,10 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -239,10 +239,10 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self
.
assertRedirects
(
response
,
reverse
(
"dashboard"
))
self
.
assertRedirects
(
response
,
reverse
(
"dashboard"
))
@ddt.data
(
@ddt.data
(
(
False
,
"
account_login
"
),
(
False
,
"
signin_user
"
),
(
False
,
"
account_regist
er"
),
(
False
,
"
register_us
er"
),
(
True
,
"
account_login
"
),
(
True
,
"
signin_user
"
),
(
True
,
"
account_regist
er"
),
(
True
,
"
register_us
er"
),
)
)
@ddt.unpack
@ddt.unpack
def
test_login_and_registration_form_signin_preserves_params
(
self
,
is_edx_domain
,
url_name
):
def
test_login_and_registration_form_signin_preserves_params
(
self
,
is_edx_domain
,
url_name
):
...
@@ -275,18 +275,18 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -275,18 +275,18 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
self
.
assertContains
(
response
,
expected_url
)
self
.
assertContains
(
response
,
expected_url
)
@mock.patch.dict
(
settings
.
FEATURES
,
{
"ENABLE_THIRD_PARTY_AUTH"
:
False
})
@mock.patch.dict
(
settings
.
FEATURES
,
{
"ENABLE_THIRD_PARTY_AUTH"
:
False
})
@ddt.data
(
"
account_login"
,
"account_regist
er"
)
@ddt.data
(
"
signin_user"
,
"register_us
er"
)
def
test_third_party_auth_disabled
(
self
,
url_name
):
def
test_third_party_auth_disabled
(
self
,
url_name
):
response
=
self
.
client
.
get
(
reverse
(
url_name
))
response
=
self
.
client
.
get
(
reverse
(
url_name
))
self
.
_assert_third_party_auth_data
(
response
,
None
,
None
,
[])
self
.
_assert_third_party_auth_data
(
response
,
None
,
None
,
[])
@ddt.data
(
@ddt.data
(
(
"
account_login
"
,
None
,
None
),
(
"
signin_user
"
,
None
,
None
),
(
"
account_regist
er"
,
None
,
None
),
(
"
register_us
er"
,
None
,
None
),
(
"
account_login
"
,
"google-oauth2"
,
"Google"
),
(
"
signin_user
"
,
"google-oauth2"
,
"Google"
),
(
"
account_regist
er"
,
"google-oauth2"
,
"Google"
),
(
"
register_us
er"
,
"google-oauth2"
,
"Google"
),
(
"
account_login
"
,
"facebook"
,
"Facebook"
),
(
"
signin_user
"
,
"facebook"
,
"Facebook"
),
(
"
account_regist
er"
,
"facebook"
,
"Facebook"
),
(
"
register_us
er"
,
"facebook"
,
"Facebook"
),
)
)
@ddt.unpack
@ddt.unpack
def
test_third_party_auth
(
self
,
url_name
,
current_backend
,
current_provider
):
def
test_third_party_auth
(
self
,
url_name
,
current_backend
,
current_provider
):
...
@@ -329,7 +329,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -329,7 +329,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
def
test_hinted_login
(
self
):
def
test_hinted_login
(
self
):
params
=
[(
"next"
,
"/courses/something/?tpa_hint=oa2-google-oauth2"
)]
params
=
[(
"next"
,
"/courses/something/?tpa_hint=oa2-google-oauth2"
)]
response
=
self
.
client
.
get
(
reverse
(
'
account_login
'
),
params
)
response
=
self
.
client
.
get
(
reverse
(
'
signin_user
'
),
params
)
self
.
assertContains
(
response
,
"data-third-party-auth-hint='oa2-google-oauth2'"
)
self
.
assertContains
(
response
,
"data-third-party-auth-hint='oa2-google-oauth2'"
)
@override_settings
(
SITE_NAME
=
settings
.
MICROSITE_TEST_HOSTNAME
)
@override_settings
(
SITE_NAME
=
settings
.
MICROSITE_TEST_HOSTNAME
)
...
@@ -337,7 +337,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -337,7 +337,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
# Retrieve the login page from a microsite domain
# Retrieve the login page from a microsite domain
# and verify that we're served the old page.
# and verify that we're served the old page.
resp
=
self
.
client
.
get
(
resp
=
self
.
client
.
get
(
reverse
(
"
account_login
"
),
reverse
(
"
signin_user
"
),
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
)
self
.
assertContains
(
resp
,
"Log into your Test Microsite Account"
)
self
.
assertContains
(
resp
,
"Log into your Test Microsite Account"
)
...
@@ -347,7 +347,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -347,7 +347,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
# Retrieve the register page from a microsite domain
# Retrieve the register page from a microsite domain
# and verify that we're served the old page.
# and verify that we're served the old page.
resp
=
self
.
client
.
get
(
resp
=
self
.
client
.
get
(
reverse
(
"
account_regist
er"
),
reverse
(
"
register_us
er"
),
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
)
self
.
assertContains
(
resp
,
"Register for Test Microsite"
)
self
.
assertContains
(
resp
,
"Register for Test Microsite"
)
...
@@ -474,7 +474,7 @@ class MicrositeLogistrationTests(TestCase):
...
@@ -474,7 +474,7 @@ class MicrositeLogistrationTests(TestCase):
"""
"""
resp
=
self
.
client
.
get
(
resp
=
self
.
client
.
get
(
reverse
(
'
account_login
'
),
reverse
(
'
signin_user
'
),
HTTP_HOST
=
settings
.
MICROSITE_LOGISTRATION_HOSTNAME
HTTP_HOST
=
settings
.
MICROSITE_LOGISTRATION_HOSTNAME
)
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
@@ -488,7 +488,7 @@ class MicrositeLogistrationTests(TestCase):
...
@@ -488,7 +488,7 @@ class MicrositeLogistrationTests(TestCase):
"""
"""
resp
=
self
.
client
.
get
(
resp
=
self
.
client
.
get
(
reverse
(
'
account_regist
er'
),
reverse
(
'
register_us
er'
),
HTTP_HOST
=
settings
.
MICROSITE_LOGISTRATION_HOSTNAME
HTTP_HOST
=
settings
.
MICROSITE_LOGISTRATION_HOSTNAME
)
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
@@ -502,7 +502,7 @@ class MicrositeLogistrationTests(TestCase):
...
@@ -502,7 +502,7 @@ class MicrositeLogistrationTests(TestCase):
"""
"""
resp
=
self
.
client
.
get
(
resp
=
self
.
client
.
get
(
reverse
(
'
account_login
'
),
reverse
(
'
signin_user
'
),
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
@@ -510,7 +510,7 @@ class MicrositeLogistrationTests(TestCase):
...
@@ -510,7 +510,7 @@ class MicrositeLogistrationTests(TestCase):
self
.
assertNotIn
(
'<div id="login-and-registration-container"'
,
resp
.
content
)
self
.
assertNotIn
(
'<div id="login-and-registration-container"'
,
resp
.
content
)
resp
=
self
.
client
.
get
(
resp
=
self
.
client
.
get
(
reverse
(
'
account_regist
er'
),
reverse
(
'
register_us
er'
),
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
...
lms/djangoapps/student_account/urls.py
View file @
cd69ca2b
...
@@ -6,8 +6,6 @@ urlpatterns = []
...
@@ -6,8 +6,6 @@ urlpatterns = []
if
settings
.
FEATURES
.
get
(
'ENABLE_COMBINED_LOGIN_REGISTRATION'
):
if
settings
.
FEATURES
.
get
(
'ENABLE_COMBINED_LOGIN_REGISTRATION'
):
urlpatterns
+=
patterns
(
urlpatterns
+=
patterns
(
'student_account.views'
,
'student_account.views'
,
url
(
r'^login/$'
,
'login_and_registration_form'
,
{
'initial_mode'
:
'login'
},
name
=
'account_login'
),
url
(
r'^register/$'
,
'login_and_registration_form'
,
{
'initial_mode'
:
'register'
},
name
=
'account_register'
),
url
(
r'^password$'
,
'password_change_request_handler'
,
name
=
'password_change_request'
),
url
(
r'^password$'
,
'password_change_request_handler'
,
name
=
'password_change_request'
),
)
)
...
...
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