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
a1e911ae
Commit
a1e911ae
authored
Aug 29, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed InvalidKeyError in course handler in studio.
LMS-11141
parent
9ca4c566
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
cms/djangoapps/contentstore/tests/test_contentstore.py
+6
-0
cms/djangoapps/contentstore/views/course.py
+4
-1
common/djangoapps/external_auth/tests/test_ssl.py
+4
-11
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
a1e911ae
...
@@ -1488,6 +1488,12 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1488,6 +1488,12 @@ class ContentStoreTest(ContentStoreTestCase):
course_module
=
self
.
store
.
get_course
(
course_key
)
course_module
=
self
.
store
.
get_course
(
course_key
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
def
test_course_handler_with_invalid_course_key_string
(
self
):
"""Test viewing the course overview page with invalid course id"""
response
=
self
.
client
.
get_html
(
'/course/edX/test'
)
self
.
assertEquals
(
response
.
status_code
,
404
)
class
MetadataSaveTestCase
(
ContentStoreTestCase
):
class
MetadataSaveTestCase
(
ContentStoreTestCase
):
"""Test that metadata is correctly cached and decached."""
"""Test that metadata is correctly cached and decached."""
...
...
cms/djangoapps/contentstore/views/course.py
View file @
a1e911ae
...
@@ -12,7 +12,7 @@ from django.conf import settings
...
@@ -12,7 +12,7 @@ from django.conf import settings
from
django.views.decorators.http
import
require_http_methods
from
django.views.decorators.http
import
require_http_methods
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpResponseBadRequest
,
HttpResponseNotFound
,
HttpResponse
from
django.http
import
HttpResponseBadRequest
,
HttpResponseNotFound
,
HttpResponse
,
Http404
from
util.json_request
import
JsonResponse
,
JsonResponseBadRequest
from
util.json_request
import
JsonResponse
,
JsonResponseBadRequest
from
util.date_utils
import
get_default_time_display
from
util.date_utils
import
get_default_time_display
from
edxmako.shortcuts
import
render_to_response
from
edxmako.shortcuts
import
render_to_response
...
@@ -208,6 +208,7 @@ def course_handler(request, course_key_string=None):
...
@@ -208,6 +208,7 @@ def course_handler(request, course_key_string=None):
DELETE
DELETE
json: delete this branch from this course (leaving off /branch/draft would imply delete the course)
json: delete this branch from this course (leaving off /branch/draft would imply delete the course)
"""
"""
try
:
response_format
=
request
.
REQUEST
.
get
(
'format'
,
'html'
)
response_format
=
request
.
REQUEST
.
get
(
'format'
,
'html'
)
if
response_format
==
'json'
or
'application/json'
in
request
.
META
.
get
(
'HTTP_ACCEPT'
,
'application/json'
):
if
response_format
==
'json'
or
'application/json'
in
request
.
META
.
get
(
'HTTP_ACCEPT'
,
'application/json'
):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
...
@@ -230,6 +231,8 @@ def course_handler(request, course_key_string=None):
...
@@ -230,6 +231,8 @@ def course_handler(request, course_key_string=None):
return
course_index
(
request
,
CourseKey
.
from_string
(
course_key_string
))
return
course_index
(
request
,
CourseKey
.
from_string
(
course_key_string
))
else
:
else
:
return
HttpResponseNotFound
()
return
HttpResponseNotFound
()
except
InvalidKeyError
:
raise
Http404
@login_required
@login_required
...
...
common/djangoapps/external_auth/tests/test_ssl.py
View file @
a1e911ae
...
@@ -200,24 +200,17 @@ class SSLClientTest(ModuleStoreTestCase):
...
@@ -200,24 +200,17 @@ class SSLClientTest(ModuleStoreTestCase):
This tests to make sure when immediate signup is on that
This tests to make sure when immediate signup is on that
the user doesn't get presented with the registration page.
the user doesn't get presented with the registration page.
"""
"""
# Expect an InvalidKeyError from course page as we don't have anything else built
response
=
self
.
client
.
get
(
with
self
.
assertRaisesRegexp
(
InvalidKeyError
,
"<class 'opaque_keys.edx.keys.CourseKey'>: None"
):
self
.
client
.
get
(
reverse
(
'signup'
),
follow
=
True
,
reverse
(
'signup'
),
follow
=
True
,
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
)
SSL_CLIENT_S_DN
=
self
.
AUTH_DN
.
format
(
self
.
USER_NAME
,
self
.
USER_EMAIL
)
)
)
self
.
assertEqual
(
response
.
status_code
,
404
)
# assert that we are logged in
# assert that we are logged in
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
self
.
assertIn
(
SESSION_KEY
,
self
.
client
.
session
)
# Now that we are logged in, make sure we don't see the registration page
# Now that we are logged in, make sure we don't see the registration page
with
self
.
assertRaisesRegexp
(
response
=
self
.
client
.
get
(
reverse
(
'signup'
),
follow
=
True
)
InvalidKeyError
,
self
.
assertEqual
(
response
.
status_code
,
404
)
"<class 'opaque_keys.edx.keys.CourseKey'>: None"
):
self
.
client
.
get
(
reverse
(
'signup'
),
follow
=
True
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@override_settings
(
FEATURES
=
FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP
)
@override_settings
(
FEATURES
=
FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP
)
...
...
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