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
037a1898
Commit
037a1898
authored
Apr 02, 2015
by
Awais Jibran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7555 from awaisdar001/aj/tnl382-fix-lms-progress-page-invalid-url
Fixed invalid URL in progress page.
parents
4db1753e
13e2ecee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletions
+37
-1
lms/djangoapps/courseware/tests/test_views.py
+32
-0
lms/djangoapps/courseware/views.py
+5
-1
No files found.
lms/djangoapps/courseware/tests/test_views.py
View file @
037a1898
...
@@ -727,6 +727,7 @@ class StartDateTests(ModuleStoreTestCase):
...
@@ -727,6 +727,7 @@ class StartDateTests(ModuleStoreTestCase):
self
.
assertIn
(
"2015-JULY-17"
,
text
)
self
.
assertIn
(
"2015-JULY-17"
,
text
)
@ddt.ddt
class
ProgressPageTests
(
ModuleStoreTestCase
):
class
ProgressPageTests
(
ModuleStoreTestCase
):
"""
"""
Tests that verify that the progress page works correctly.
Tests that verify that the progress page works correctly.
...
@@ -757,8 +758,39 @@ class ProgressPageTests(ModuleStoreTestCase):
...
@@ -757,8 +758,39 @@ class ProgressPageTests(ModuleStoreTestCase):
resp
=
views
.
progress
(
self
.
request
,
course_id
=
self
.
course
.
id
.
to_deprecated_string
())
resp
=
views
.
progress
(
self
.
request
,
course_id
=
self
.
course
.
id
.
to_deprecated_string
())
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
@ddt.data
(
ModuleStoreEnum
.
Type
.
mongo
,
ModuleStoreEnum
.
Type
.
split
)
def
test_student_progress_with_valid_and_invalid_id
(
self
,
default_store
):
"""
Check that invalid 'student_id' raises Http404 for both old mongo and
split mongo courses.
"""
# Create new course with respect to 'default_store'
self
.
course
=
CourseFactory
.
create
(
default_store
=
default_store
)
# Invalid Student Ids (Integer and Non-int)
invalid_student_ids
=
[
991021
,
'azU3N_8$'
,
]
for
invalid_id
in
invalid_student_ids
:
self
.
assertRaises
(
Http404
,
views
.
progress
,
self
.
request
,
course_id
=
unicode
(
self
.
course
.
id
),
student_id
=
invalid_id
)
# Enroll student into course
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course
.
id
,
mode
=
'honor'
)
resp
=
views
.
progress
(
self
.
request
,
course_id
=
self
.
course
.
id
.
to_deprecated_string
(),
student_id
=
self
.
user
.
id
)
# Assert that valid 'student_id' returns 200 status
self
.
assertEqual
(
resp
.
status_code
,
200
)
def
test_non_asci_grade_cutoffs
(
self
):
def
test_non_asci_grade_cutoffs
(
self
):
resp
=
views
.
progress
(
self
.
request
,
course_id
=
self
.
course
.
id
.
to_deprecated_string
())
resp
=
views
.
progress
(
self
.
request
,
course_id
=
self
.
course
.
id
.
to_deprecated_string
())
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
def
test_generate_cert_config
(
self
):
def
test_generate_cert_config
(
self
):
...
...
lms/djangoapps/courseware/views.py
View file @
037a1898
...
@@ -1051,7 +1051,11 @@ def _progress(request, course_key, student_id):
...
@@ -1051,7 +1051,11 @@ def _progress(request, course_key, student_id):
# Requesting access to a different student's profile
# Requesting access to a different student's profile
if
not
staff_access
:
if
not
staff_access
:
raise
Http404
raise
Http404
student
=
User
.
objects
.
get
(
id
=
int
(
student_id
))
try
:
student
=
User
.
objects
.
get
(
id
=
student_id
)
# Check for ValueError if 'student_id' cannot be converted to integer.
except
(
ValueError
,
User
.
DoesNotExist
):
raise
Http404
# NOTE: To make sure impersonation by instructor works, use
# NOTE: To make sure impersonation by instructor works, use
# student instead of request.user in the rest of the function.
# student instead of request.user in the rest of the function.
...
...
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