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
a900e1f7
Commit
a900e1f7
authored
Apr 23, 2015
by
Aamir
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7660 from edx/aamir-khan/ECOM-1396/checkoint-name-field
Aamir khan/ecom 1396/checkoint name field
parents
2f3ff43e
d606ae97
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
91 additions
and
17 deletions
+91
-17
lms/djangoapps/verify_student/services.py
+8
-1
lms/djangoapps/verify_student/tests/test_services.py
+64
-0
lms/djangoapps/verify_student/tests/test_views.py
+1
-1
lms/djangoapps/verify_student/urls.py
+4
-2
lms/djangoapps/verify_student/views.py
+6
-5
lms/envs/common.py
+1
-1
lms/static/js/verify_student/incourse_reverify.js
+1
-1
lms/static/js/verify_student/models/reverification_model.js
+3
-3
lms/static/js/verify_student/views/incourse_reverify_view.js
+2
-2
lms/templates/verify_student/incourse_reverify.html
+1
-1
No files found.
lms/djangoapps/verify_student/services.py
View file @
a900e1f7
...
@@ -46,5 +46,12 @@ class ReverificationService(object):
...
@@ -46,5 +46,12 @@ class ReverificationService(object):
"""
"""
course_key
=
CourseKey
.
from_string
(
course_id
)
course_key
=
CourseKey
.
from_string
(
course_id
)
VerificationCheckpoint
.
objects
.
get_or_create
(
course_id
=
course_key
,
checkpoint_name
=
checkpoint_name
)
VerificationCheckpoint
.
objects
.
get_or_create
(
course_id
=
course_key
,
checkpoint_name
=
checkpoint_name
)
re_verification_link
=
reverse
(
"verify_student_incourse_reverify"
,
args
=
(
course_id
,
checkpoint_name
,
item_id
))
re_verification_link
=
reverse
(
'verify_student_incourse_reverify'
,
args
=
(
unicode
(
course_key
),
unicode
(
checkpoint_name
),
unicode
(
item_id
)
)
)
return
re_verification_link
return
re_verification_link
lms/djangoapps/verify_student/tests/test_services.py
0 → 100644
View file @
a900e1f7
# encoding: utf-8
"""
Tests of reverify service.
"""
import
ddt
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
student.tests.factories
import
UserFactory
from
course_modes.tests.factories
import
CourseModeFactory
from
verify_student.services
import
ReverificationService
from
verify_student.models
import
VerificationCheckpoint
,
VerificationStatus
@ddt.ddt
class
TestReverifyService
(
ModuleStoreTestCase
):
"""
Tests for the re-verification service
"""
def
setUp
(
self
):
super
(
TestReverifyService
,
self
)
.
setUp
()
self
.
user
=
UserFactory
.
create
(
username
=
"rusty"
,
password
=
"test"
)
course
=
CourseFactory
.
create
(
org
=
'Robot'
,
number
=
'999'
,
display_name
=
'Test Course'
)
self
.
course_key
=
course
.
id
CourseModeFactory
(
mode_slug
=
"verified"
,
course_id
=
self
.
course_key
,
min_price
=
100
,
suggested_prices
=
''
)
self
.
item
=
ItemFactory
.
create
(
parent
=
course
,
category
=
'chapter'
,
display_name
=
'Test Section'
)
@ddt.data
(
"final_term"
,
"mid_term"
)
def
test_start_verification
(
self
,
checkpoint_name
):
"""Testing start verification service. If checkpoint exists for specific course then returns the checkpoint
otherwise created that checkpoint.
"""
rev
=
ReverificationService
()
rev
.
start_verification
(
unicode
(
self
.
course_key
),
checkpoint_name
,
self
.
item
.
location
)
expected_url
=
(
'/verify_student/reverify'
'/{course_key}'
'/{checkpoint_name}'
'/{usage_id}/'
)
.
format
(
course_key
=
unicode
(
self
.
course_key
),
checkpoint_name
=
checkpoint_name
,
usage_id
=
self
.
item
.
location
)
self
.
assertEqual
(
expected_url
,
rev
.
start_verification
(
unicode
(
self
.
course_key
),
checkpoint_name
,
self
.
item
.
location
)
)
def
test_get_status
(
self
):
""" Check if the user has any verification attempt for the checkpoint and course_id """
checkpoint_name
=
'final_term'
rev
=
ReverificationService
()
self
.
assertIsNone
(
rev
.
get_status
(
self
.
user
.
id
,
unicode
(
self
.
course_key
),
checkpoint_name
))
checkpoint_obj
=
VerificationCheckpoint
.
objects
.
create
(
course_id
=
unicode
(
self
.
course_key
),
checkpoint_name
=
checkpoint_name
)
VerificationStatus
.
objects
.
create
(
checkpoint
=
checkpoint_obj
,
user
=
self
.
user
,
status
=
'submitted'
)
self
.
assertEqual
(
rev
.
get_status
(
self
.
user
.
id
,
unicode
(
self
.
course_key
),
checkpoint_name
),
'submitted'
)
lms/djangoapps/verify_student/tests/test_views.py
View file @
a900e1f7
...
@@ -1888,5 +1888,5 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
...
@@ -1888,5 +1888,5 @@ class TestInCourseReverifyView(ModuleStoreTestCase):
kwargs
=
{
kwargs
=
{
"course_id"
:
unicode
(
course_key
),
"course_id"
:
unicode
(
course_key
),
"checkpoint_name"
:
checkpoint
,
"checkpoint_name"
:
checkpoint
,
"
location
"
:
unicode
(
self
.
reverification_location
)
"
usage_id
"
:
unicode
(
self
.
reverification_location
)
})
})
lms/djangoapps/verify_student/urls.py
View file @
a900e1f7
...
@@ -143,8 +143,10 @@ urlpatterns = patterns(
...
@@ -143,8 +143,10 @@ urlpatterns = patterns(
# Users are sent to this end-point from within courseware
# Users are sent to this end-point from within courseware
# to re-verify their identities by re-submitting face photos.
# to re-verify their identities by re-submitting face photos.
url
(
url
(
r'^reverify/{course_id}/{checkpoint}/(?P<location>.*)/$'
.
format
(
r'^reverify/{course_id}/{checkpoint}/{usage_id}/$'
.
format
(
course_id
=
settings
.
COURSE_ID_PATTERN
,
checkpoint
=
settings
.
CHECKPOINT_PATTERN
course_id
=
settings
.
COURSE_ID_PATTERN
,
checkpoint
=
settings
.
CHECKPOINT_PATTERN
,
usage_id
=
settings
.
USAGE_ID_PATTERN
),
),
views
.
InCourseReverifyView
.
as_view
(),
views
.
InCourseReverifyView
.
as_view
(),
name
=
"verify_student_incourse_reverify"
name
=
"verify_student_incourse_reverify"
...
...
lms/djangoapps/verify_student/views.py
View file @
a900e1f7
...
@@ -1115,9 +1115,10 @@ class InCourseReverifyView(View):
...
@@ -1115,9 +1115,10 @@ class InCourseReverifyView(View):
Does not need to worry about pricing
Does not need to worry about pricing
"""
"""
@method_decorator
(
login_required
)
@method_decorator
(
login_required
)
def
get
(
self
,
request
,
course_id
,
checkpoint_name
,
location
):
def
get
(
self
,
request
,
course_id
,
checkpoint_name
,
usage_id
):
""" Display the view for face photo submission"""
""" Display the view for face photo submission"""
# Check the in-course re-verification is enabled or not
# Check the in-course re-verification is enabled or not
incourse_reverify_enabled
=
InCourseReverificationConfiguration
.
current
()
.
enabled
incourse_reverify_enabled
=
InCourseReverificationConfiguration
.
current
()
.
enabled
if
not
incourse_reverify_enabled
:
if
not
incourse_reverify_enabled
:
raise
Http404
raise
Http404
...
@@ -1146,12 +1147,12 @@ class InCourseReverifyView(View):
...
@@ -1146,12 +1147,12 @@ class InCourseReverifyView(View):
'course_name'
:
course
.
display_name_with_default
,
'course_name'
:
course
.
display_name_with_default
,
'checkpoint_name'
:
checkpoint_name
,
'checkpoint_name'
:
checkpoint_name
,
'platform_name'
:
settings
.
PLATFORM_NAME
,
'platform_name'
:
settings
.
PLATFORM_NAME
,
'
location'
:
location
'
usage_id'
:
usage_id
}
}
return
render_to_response
(
"verify_student/incourse_reverify.html"
,
context
)
return
render_to_response
(
"verify_student/incourse_reverify.html"
,
context
)
@method_decorator
(
login_required
)
@method_decorator
(
login_required
)
def
post
(
self
,
request
,
course_id
,
checkpoint_name
,
location
):
def
post
(
self
,
request
,
course_id
,
checkpoint_name
,
usage_id
):
"""Submits the re-verification attempt to SoftwareSecure
"""Submits the re-verification attempt to SoftwareSecure
Args:
Args:
...
@@ -1172,7 +1173,7 @@ class InCourseReverifyView(View):
...
@@ -1172,7 +1173,7 @@ class InCourseReverifyView(View):
user
=
request
.
user
user
=
request
.
user
try
:
try
:
course_key
=
CourseKey
.
from_string
(
course_id
)
course_key
=
CourseKey
.
from_string
(
course_id
)
usage_key
=
UsageKey
.
from_string
(
location
)
.
replace
(
course_key
=
course_key
)
usage_key
=
UsageKey
.
from_string
(
usage_id
)
.
replace
(
course_key
=
course_key
)
except
InvalidKeyError
:
except
InvalidKeyError
:
raise
Http404
(
u"Invalid course_key or usage_key"
)
raise
Http404
(
u"Invalid course_key or usage_key"
)
course
=
modulestore
()
.
get_course
(
course_key
)
course
=
modulestore
()
.
get_course
(
course_key
)
...
@@ -1187,7 +1188,7 @@ class InCourseReverifyView(View):
...
@@ -1187,7 +1188,7 @@ class InCourseReverifyView(View):
'error'
:
True
,
'error'
:
True
,
'errorMsg'
:
_
(
"No checkpoint found"
),
'errorMsg'
:
_
(
"No checkpoint found"
),
'platform_name'
:
settings
.
PLATFORM_NAME
,
'platform_name'
:
settings
.
PLATFORM_NAME
,
'
location'
:
location
'
usage_id'
:
usage_id
}
}
return
render_to_response
(
"verify_student/incourse_reverify.html"
,
context
)
return
render_to_response
(
"verify_student/incourse_reverify.html"
,
context
)
init_verification
=
SoftwareSecurePhotoVerification
.
get_initial_verification
(
user
)
init_verification
=
SoftwareSecurePhotoVerification
.
get_initial_verification
(
user
)
...
...
lms/envs/common.py
View file @
a900e1f7
...
@@ -2252,7 +2252,7 @@ ECOMMERCE_API_SIGNING_KEY = None
...
@@ -2252,7 +2252,7 @@ ECOMMERCE_API_SIGNING_KEY = None
ECOMMERCE_API_TIMEOUT
=
5
ECOMMERCE_API_TIMEOUT
=
5
# Reverification checkpoint name pattern
# Reverification checkpoint name pattern
CHECKPOINT_PATTERN
=
r'(?P<checkpoint_name>
\w
+)'
CHECKPOINT_PATTERN
=
r'(?P<checkpoint_name>
[\w ]
+)'
# For the fields override feature
# For the fields override feature
# If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add
# If using FEATURES['INDIVIDUAL_DUE_DATES'], you should add
...
...
lms/static/js/verify_student/incourse_reverify.js
View file @
a900e1f7
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
courseKey
:
el
.
data
(
'course-key'
),
courseKey
:
el
.
data
(
'course-key'
),
checkpointName
:
el
.
data
(
'checkpoint-name'
),
checkpointName
:
el
.
data
(
'checkpoint-name'
),
platformName
:
el
.
data
(
'platform-name'
),
platformName
:
el
.
data
(
'platform-name'
),
location
:
el
.
data
(
'location
'
),
usageId
:
el
.
data
(
'usage-id
'
),
errorModel
:
errorView
.
model
errorModel
:
errorView
.
model
}).
render
();
}).
render
();
...
...
lms/static/js/verify_student/models/reverification_model.js
View file @
a900e1f7
...
@@ -18,7 +18,7 @@ var edx = edx || {};
...
@@ -18,7 +18,7 @@ var edx = edx || {};
courseKey
:
''
,
courseKey
:
''
,
checkpointName
:
''
,
checkpointName
:
''
,
faceImage
:
''
,
faceImage
:
''
,
location
:
''
usageId
:
''
},
},
sync
:
function
(
method
)
{
sync
:
function
(
method
)
{
...
@@ -28,10 +28,10 @@ var edx = edx || {};
...
@@ -28,10 +28,10 @@ var edx = edx || {};
face_image
:
model
.
get
(
'faceImage'
)
face_image
:
model
.
get
(
'faceImage'
)
},
},
url
=
_
.
str
.
sprintf
(
url
=
_
.
str
.
sprintf
(
'/verify_student/reverify/%(courseKey)s/%(checkpointName)s/%(
location
)s/'
,
{
'/verify_student/reverify/%(courseKey)s/%(checkpointName)s/%(
usageId
)s/'
,
{
courseKey
:
model
.
get
(
'courseKey'
),
courseKey
:
model
.
get
(
'courseKey'
),
checkpointName
:
model
.
get
(
'checkpointName'
),
checkpointName
:
model
.
get
(
'checkpointName'
),
location
:
model
.
get
(
'location
'
)
usageId
:
model
.
get
(
'usageId
'
)
}
}
);
);
...
...
lms/static/js/verify_student/views/incourse_reverify_view.js
View file @
a900e1f7
...
@@ -28,13 +28,13 @@
...
@@ -28,13 +28,13 @@
this
.
courseKey
=
obj
.
courseKey
||
null
;
this
.
courseKey
=
obj
.
courseKey
||
null
;
this
.
checkpointName
=
obj
.
checkpointName
||
null
;
this
.
checkpointName
=
obj
.
checkpointName
||
null
;
this
.
platformName
=
obj
.
platformName
||
null
;
this
.
platformName
=
obj
.
platformName
||
null
;
this
.
location
=
obj
.
location
||
null
;
this
.
usageId
=
obj
.
usageId
||
null
;
this
.
model
=
new
edx
.
verify_student
.
ReverificationModel
({
this
.
model
=
new
edx
.
verify_student
.
ReverificationModel
({
courseKey
:
this
.
courseKey
,
courseKey
:
this
.
courseKey
,
checkpointName
:
this
.
checkpointName
,
checkpointName
:
this
.
checkpointName
,
location
:
this
.
location
usageId
:
this
.
usageId
});
});
this
.
listenTo
(
this
.
model
,
'sync'
,
_
.
bind
(
this
.
handleSubmitPhotoSuccess
,
this
));
this
.
listenTo
(
this
.
model
,
'sync'
,
_
.
bind
(
this
.
handleSubmitPhotoSuccess
,
this
));
...
...
lms/templates/verify_student/incourse_reverify.html
View file @
a900e1f7
...
@@ -46,7 +46,7 @@ checkpoint_name=checkpoint_name)}
...
@@ -46,7 +46,7 @@ checkpoint_name=checkpoint_name)}
data-course-key=
'${course_key}'
data-course-key=
'${course_key}'
data-checkpoint-name=
'${checkpoint_name}'
data-checkpoint-name=
'${checkpoint_name}'
data-platform-name=
'${platform_name}'
data-platform-name=
'${platform_name}'
data-
location=
'${location
}'
data-
usage-id=
'${usage_id
}'
></div>
></div>
</section>
</section>
</div>
</div>
...
...
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