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
bf9ac26a
Commit
bf9ac26a
authored
Nov 25, 2013
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected CMS tests so that one is passing, added external_auth to cms apps
Several pylint fixes and bad super call
parent
96c7cb5f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
13 deletions
+19
-13
cms/envs/common.py
+3
-0
common/djangoapps/external_auth/tests/test_ssl.py
+15
-12
common/djangoapps/external_auth/views.py
+1
-1
No files found.
cms/envs/common.py
View file @
bf9ac26a
...
...
@@ -385,6 +385,9 @@ INSTALLED_APPS = (
'student'
,
# misleading name due to sharing with lms
'course_groups'
,
# not used in cms (yet), but tests run
# External auth (OpenID, shib, SSL)
'external_auth'
,
# Tracking
'track'
,
'eventtracking.django'
,
...
...
common/djangoapps/external_auth/tests/test_ssl.py
View file @
bf9ac26a
...
...
@@ -45,7 +45,7 @@ class SSLClientTest(TestCase):
def
setUp
(
self
):
"""Setup test case by adding primary user."""
super
(
TestCase
,
self
)
.
setUp
()
super
(
SSLClientTest
,
self
)
.
setUp
()
self
.
client
=
Client
()
self
.
factory
=
RequestFactory
()
...
...
@@ -62,7 +62,7 @@ class SSLClientTest(TestCase):
# auth should not have a user
self
.
assertIn
(
'<form role="form" id="register-form" method="post"'
,
response
.
content
)
try
:
eamap_user
=
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
except
ExternalAuthMap
.
DoesNotExist
,
ex
:
self
.
fail
(
'User did not get properly added to external auth map, exception was {0}'
.
format
(
str
(
ex
)))
...
...
@@ -80,10 +80,13 @@ class SSLClientTest(TestCase):
some point. using skip here instead of expectFailure because
of an issue with nose.
"""
response
=
external_auth
.
views
.
ssl_login
(
self
.
_create_ssl_request
(
reverse
(
'contentstore.views.login_page'
)))
self
.
client
.
get
(
reverse
(
'contentstore.views.login_page'
),
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
)
)
try
:
eamap_user
=
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
except
ExternalAuthMap
.
DoesNotExist
,
ex
:
self
.
fail
(
'User did not get properly added to external auth map, exception was {0}'
.
format
(
str
(
ex
)))
...
...
@@ -98,21 +101,20 @@ class SSLClientTest(TestCase):
and the user is redirected to slash.
"""
response
=
external_auth
.
views
.
ssl_login
(
self
.
_create_ssl_request
(
'/'
))
external_auth
.
views
.
ssl_login
(
self
.
_create_ssl_request
(
'/'
))
# Assert our user exists in both eamap and Users, and that we are logged in
try
:
eamap_user
=
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
except
ExternalAuthMap
.
DoesNotExist
,
ex
:
self
.
fail
(
'User did not get properly added to external auth map, exception was {0}'
.
format
(
str
(
ex
)))
try
:
user
=
User
.
objects
.
get
(
email
=
self
.
USER_EMAIL
)
User
.
objects
.
get
(
email
=
self
.
USER_EMAIL
)
except
ExternalAuthMap
.
DoesNotExist
,
ex
:
self
.
fail
(
'User did not get properly added to internal users, exception was {0}'
.
format
(
str
(
ex
)))
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'cms.urls'
,
'Test only valid in cms'
)
@override_settings
(
MITX_FEATURES
=
MITX_FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP
)
@unittest.skip
def
test_ssl_login_without_signup_cms
(
self
):
"""
Test IMMEDIATE_SIGNUP feature flag and ensure the user account is
...
...
@@ -123,16 +125,17 @@ class SSLClientTest(TestCase):
of an issue with nose.
"""
response
=
external_auth
.
views
.
ssl_login
(
self
.
_create_ssl_request
(
reverse
(
'contentstore.views.login_page'
))
self
.
client
.
get
(
reverse
(
'contentstore.views.login_page'
),
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
)
)
# Assert our user exists in both eamap and Users, and that we are logged in
try
:
eamap_user
=
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
ExternalAuthMap
.
objects
.
get
(
external_id
=
self
.
USER_EMAIL
)
except
ExternalAuthMap
.
DoesNotExist
,
ex
:
self
.
fail
(
'User did not get properly added to external auth map, exception was {0}'
.
format
(
str
(
ex
)))
try
:
user
=
User
.
objects
.
get
(
email
=
self
.
USER_EMAIL
)
User
.
objects
.
get
(
email
=
self
.
USER_EMAIL
)
except
ExternalAuthMap
.
DoesNotExist
,
ex
:
self
.
fail
(
'User did not get properly added to internal users, exception was {0}'
.
format
(
str
(
ex
)))
common/djangoapps/external_auth/views.py
View file @
bf9ac26a
...
...
@@ -258,7 +258,7 @@ def _signup(request, eamap):
post_vars
=
dict
(
username
=
username
,
honor_code
=
u'true'
,
terms_of_service
=
u'true'
)
log
.
info
(
'doing immediate signup for
%
s, params=
%
s'
%
(
username
,
post_vars
)
)
log
.
info
(
'doing immediate signup for
%
s, params=
%
s'
,
username
,
post_vars
)
student
.
views
.
create_account
(
request
,
post_vars
)
return
redirect
(
'/'
)
...
...
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