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
c84a6049
Commit
c84a6049
authored
Dec 16, 2014
by
stephensanchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Positive filtering which steps can be skipped.
parent
5371d173
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletions
+32
-1
lms/djangoapps/verify_student/tests/test_views.py
+24
-0
lms/djangoapps/verify_student/views.py
+8
-1
No files found.
lms/djangoapps/verify_student/tests/test_views.py
View file @
c84a6049
...
...
@@ -1241,6 +1241,30 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase):
PayAndVerifyView
.
FACE_PHOTO_STEP
,
)
def
test_payment_cannot_skip
(
self
):
"""
Simple test to verify that certain steps cannot be skipped. This test sets up
a scenario where the user should be on the MAKE_PAYMENT_STEP, but is trying to
skip it. Despite setting the parameter, the current step should still be
MAKE_PAYMENT_STEP.
"""
course
=
self
.
_create_course
(
"verified"
)
response
=
self
.
_get_page
(
'verify_student_start_flow'
,
course
.
id
,
skip_first_step
=
True
)
self
.
_assert_messaging
(
response
,
PayAndVerifyView
.
FIRST_TIME_VERIFY_MSG
)
# Expect that *all* steps are displayed,
# but we start on the first verify step
self
.
_assert_steps_displayed
(
response
,
PayAndVerifyView
.
PAYMENT_STEPS
+
PayAndVerifyView
.
VERIFICATION_STEPS
,
PayAndVerifyView
.
MAKE_PAYMENT_STEP
,
)
def
test_payment_confirmation_already_verified
(
self
):
course
=
self
.
_create_course
(
"verified"
)
self
.
_enroll
(
course
.
id
,
"verified"
)
...
...
lms/djangoapps/verify_student/views.py
View file @
c84a6049
...
...
@@ -259,6 +259,12 @@ class PayAndVerifyView(View):
ENROLLMENT_CONFIRMATION_STEP
]
# These are steps that can be skipped, since there are no barring requirements.
SKIP_STEPS
=
[
INTRO_STEP
,
PAYMENT_CONFIRMATION_STEP
]
Step
=
namedtuple
(
'Step'
,
[
...
...
@@ -458,7 +464,8 @@ class PayAndVerifyView(View):
# Allow the caller to skip the first page
# This is useful if we want the user to be able to
# use the "back" button to return to the previous step.
if
request
.
GET
.
get
(
'skip-first-step'
):
# This parameter should only work for known skip-able steps
if
request
.
GET
.
get
(
'skip-first-step'
)
and
current_step
in
self
.
SKIP_STEPS
:
display_step_names
=
[
step
[
'name'
]
for
step
in
display_steps
]
current_step_idx
=
display_step_names
.
index
(
current_step
)
if
(
current_step_idx
+
1
)
<
len
(
display_steps
):
...
...
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