Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
c84a6049
Commit
c84a6049
authored
10 years ago
by
stephensanchez
Browse files
Options
Downloads
Patches
Plain Diff
Positive filtering which steps can be skipped.
parent
5371d173
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/verify_student/tests/test_views.py
+24
-0
24 additions, 0 deletions
lms/djangoapps/verify_student/tests/test_views.py
lms/djangoapps/verify_student/views.py
+8
-1
8 additions, 1 deletion
lms/djangoapps/verify_student/views.py
with
32 additions
and
1 deletion
lms/djangoapps/verify_student/tests/test_views.py
+
24
−
0
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
"
)
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/verify_student/views.py
+
8
−
1
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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment