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
b7d526b9
Commit
b7d526b9
authored
Nov 11, 2014
by
zubair-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid annonymous user from redirecting to survey form
WL-150
parent
d02747ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
lms/djangoapps/courseware/tests/test_course_survey.py
+14
-0
lms/djangoapps/courseware/views.py
+1
-1
No files found.
lms/djangoapps/courseware/tests/test_course_survey.py
View file @
b7d526b9
...
@@ -106,6 +106,20 @@ class SurveyViewsTests(LoginEnrollmentTestCase):
...
@@ -106,6 +106,20 @@ class SurveyViewsTests(LoginEnrollmentTestCase):
"""
"""
self
.
_assert_survey_redirect
(
self
.
course
)
self
.
_assert_survey_redirect
(
self
.
course
)
def
test_anonymous_user_visiting_course_with_survey
(
self
):
"""
Verifies that anonymous user going to the courseware info with an unanswered survey is not
redirected to survery and info page renders without server error.
"""
self
.
logout
()
resp
=
self
.
client
.
get
(
reverse
(
'info'
,
kwargs
=
{
'course_id'
:
unicode
(
self
.
course
.
id
)}
)
)
self
.
assertEquals
(
resp
.
status_code
,
200
)
def
test_visiting_course_with_existing_answers
(
self
):
def
test_visiting_course_with_existing_answers
(
self
):
"""
"""
Verifies that going to the courseware with an answered survey, there is no redirect
Verifies that going to the courseware with an answered survey, there is no redirect
...
...
lms/djangoapps/courseware/views.py
View file @
b7d526b9
...
@@ -586,7 +586,7 @@ def course_info(request, course_id):
...
@@ -586,7 +586,7 @@ def course_info(request, course_id):
# check to see if there is a required survey that must be taken before
# check to see if there is a required survey that must be taken before
# the user can access the course.
# the user can access the course.
if
survey
.
utils
.
must_answer_survey
(
course
,
request
.
user
):
if
request
.
user
.
is_authenticated
()
and
survey
.
utils
.
must_answer_survey
(
course
,
request
.
user
):
return
redirect
(
reverse
(
'course_survey'
,
args
=
[
unicode
(
course
.
id
)]))
return
redirect
(
reverse
(
'course_survey'
,
args
=
[
unicode
(
course
.
id
)]))
staff_access
=
has_access
(
request
.
user
,
'staff'
,
course
)
staff_access
=
has_access
(
request
.
user
,
'staff'
,
course
)
...
...
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