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
5198257c
Commit
5198257c
authored
Jun 10, 2015
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8461 from edx/will/verify-student-cleanup
Remove unused code left over from ECOM-188.
parents
4dd55609
69306da4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
83 deletions
+6
-83
common/djangoapps/student/tests/test_verification_status.py
+1
-6
lms/djangoapps/verify_student/tests/test_views.py
+4
-47
lms/djangoapps/verify_student/views.py
+0
-29
lms/static/js/verify_student/views/incourse_reverify_view.js
+1
-1
No files found.
common/djangoapps/student/tests/test_verification_status.py
View file @
5198257c
...
@@ -41,12 +41,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
...
@@ -41,12 +41,7 @@ class TestCourseVerificationStatus(UrlResetMixin, ModuleStoreTestCase):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
success
=
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
"edx"
)
success
=
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
"edx"
)
self
.
assertTrue
(
success
,
msg
=
"Did not log in successfully"
)
self
.
assertTrue
(
success
,
msg
=
"Did not log in successfully"
)
self
.
dashboard_url
=
reverse
(
'dashboard'
)
# Use the URL with the querystring param to put the user
# in the experimental track.
# TODO (ECOM-188): Once the A/B test of decoupling verified / payment
# completes, we can remove the querystring param.
self
.
dashboard_url
=
reverse
(
'dashboard'
)
+
'?separate-verified=1'
def
test_enrolled_as_non_verified
(
self
):
def
test_enrolled_as_non_verified
(
self
):
self
.
_setup_mode_and_enrollment
(
None
,
"honor"
)
self
.
_setup_mode_and_enrollment
(
None
,
"honor"
)
...
...
lms/djangoapps/verify_student/tests/test_views.py
View file @
5198257c
...
@@ -1054,8 +1054,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1054,8 +1054,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
"""
"""
Tests for the create_order view of verified course enrollment process.
Tests for the create_order view of verified course enrollment process.
"""
"""
# Minimum size valid image data
IMAGE_DATA
=
','
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestCreateOrderView
,
self
)
.
setUp
()
super
(
TestCreateOrderView
,
self
)
.
setUp
()
...
@@ -1082,24 +1080,9 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1082,24 +1080,9 @@ class TestCreateOrderView(ModuleStoreTestCase):
course_mode_post_data
course_mode_post_data
)
)
def
test_invalid_photos_data
(
self
):
self
.
_create_order
(
50
,
self
.
course_id
,
face_image
=
''
,
photo_id_image
=
''
,
expect_success
=
False
)
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
def
test_invalid_amount
(
self
):
def
test_invalid_amount
(
self
):
response
=
self
.
_create_order
(
response
=
self
.
_create_order
(
'1.a'
,
self
.
course_id
,
expect_status_code
=
400
)
'1.a'
,
self
.
course_id
,
face_image
=
self
.
IMAGE_DATA
,
photo_id_image
=
self
.
IMAGE_DATA
,
expect_status_code
=
400
)
self
.
assertIn
(
'Selected price is not valid number.'
,
response
.
content
)
self
.
assertIn
(
'Selected price is not valid number.'
,
response
.
content
)
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
...
@@ -1107,13 +1090,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1107,13 +1090,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
# Create a course that does not have a verified mode
# Create a course that does not have a verified mode
course_id
=
'Fake/999/Test_Course'
course_id
=
'Fake/999/Test_Course'
CourseFactory
.
create
(
org
=
'Fake'
,
number
=
'999'
,
display_name
=
'Test Course'
)
CourseFactory
.
create
(
org
=
'Fake'
,
number
=
'999'
,
display_name
=
'Test Course'
)
response
=
self
.
_create_order
(
response
=
self
.
_create_order
(
'50'
,
course_id
,
expect_status_code
=
400
)
'50'
,
course_id
,
face_image
=
self
.
IMAGE_DATA
,
photo_id_image
=
self
.
IMAGE_DATA
,
expect_status_code
=
400
)
self
.
assertIn
(
'This course doesn
\'
t support paid certificates'
,
response
.
content
)
self
.
assertIn
(
'This course doesn
\'
t support paid certificates'
,
response
.
content
)
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
...
@@ -1121,8 +1098,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1121,8 +1098,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
create_order_post_data
=
{
create_order_post_data
=
{
'contribution'
:
50
,
'contribution'
:
50
,
'course_id'
:
self
.
course_id
,
'course_id'
:
self
.
course_id
,
'face_image'
:
self
.
IMAGE_DATA
,
'photo_id_image'
:
self
.
IMAGE_DATA
,
}
}
# Use the wrong HTTP method
# Use the wrong HTTP method
...
@@ -1131,12 +1106,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1131,12 +1106,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'
:
True
})
def
test_create_order_success
(
self
):
def
test_create_order_success
(
self
):
response
=
self
.
_create_order
(
response
=
self
.
_create_order
(
50
,
self
.
course_id
)
50
,
self
.
course_id
,
face_image
=
self
.
IMAGE_DATA
,
photo_id_image
=
self
.
IMAGE_DATA
)
json_response
=
json
.
loads
(
response
.
content
)
json_response
=
json
.
loads
(
response
.
content
)
self
.
assertIsNotNone
(
json_response
[
'payment_form_data'
]
.
get
(
'orderNumber'
))
# TODO not canonical
self
.
assertIsNotNone
(
json_response
[
'payment_form_data'
]
.
get
(
'orderNumber'
))
# TODO not canonical
...
@@ -1148,13 +1118,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1148,13 +1118,7 @@ class TestCreateOrderView(ModuleStoreTestCase):
self
.
assertEqual
(
item
.
course_id
,
self
.
course
.
id
)
self
.
assertEqual
(
item
.
course_id
,
self
.
course
.
id
)
self
.
assertEqual
(
item
.
mode
,
'verified'
)
self
.
assertEqual
(
item
.
mode
,
'verified'
)
def
_create_order
(
def
_create_order
(
self
,
contribution
,
course_id
,
expect_success
=
True
,
expect_status_code
=
200
):
self
,
contribution
,
course_id
,
face_image
=
None
,
photo_id_image
=
None
,
expect_success
=
True
,
expect_status_code
=
200
):
"""Create a new order.
"""Create a new order.
Arguments:
Arguments:
...
@@ -1162,8 +1126,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1162,8 +1126,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
course_id (CourseKey): The course to purchase.
course_id (CourseKey): The course to purchase.
Keyword Arguments:
Keyword Arguments:
face_image (string): Base-64 encoded image data
photo_id_image (string): Base-64 encoded image data
expect_success (bool): If True, verify that the response was successful.
expect_success (bool): If True, verify that the response was successful.
expect_status_code (int): The expected HTTP status code
expect_status_code (int): The expected HTTP status code
...
@@ -1178,11 +1140,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
...
@@ -1178,11 +1140,6 @@ class TestCreateOrderView(ModuleStoreTestCase):
'processor'
:
None
,
'processor'
:
None
,
}
}
if
face_image
is
not
None
:
data
[
'face_image'
]
=
face_image
if
photo_id_image
is
not
None
:
data
[
'photo_id_image'
]
=
photo_id_image
response
=
self
.
client
.
post
(
url
,
data
)
response
=
self
.
client
.
post
(
url
,
data
)
self
.
assertEqual
(
response
.
status_code
,
expect_status_code
)
self
.
assertEqual
(
response
.
status_code
,
expect_status_code
)
...
...
lms/djangoapps/verify_student/views.py
View file @
5198257c
...
@@ -708,35 +708,6 @@ def create_order(request):
...
@@ -708,35 +708,6 @@ def create_order(request):
actual use is to add a single product to the user's cart and request
actual use is to add a single product to the user's cart and request
immediate checkout.
immediate checkout.
"""
"""
# Only submit photos if photo data is provided by the client.
# TODO (ECOM-188): Once the A/B test of decoupling verified / payment
# completes, we may be able to remove photo submission from this step
# entirely.
submit_photo
=
(
'face_image'
in
request
.
POST
and
'photo_id_image'
in
request
.
POST
)
if
(
submit_photo
and
not
SoftwareSecurePhotoVerification
.
user_has_valid_or_pending
(
request
.
user
)
):
attempt
=
SoftwareSecurePhotoVerification
(
user
=
request
.
user
)
try
:
b64_face_image
=
request
.
POST
[
'face_image'
]
.
split
(
","
)[
1
]
b64_photo_id_image
=
request
.
POST
[
'photo_id_image'
]
.
split
(
","
)[
1
]
except
IndexError
:
log
.
error
(
u"Invalid image data during photo verification."
)
context
=
{
'success'
:
False
,
}
return
JsonResponse
(
context
)
attempt
.
upload_face_image
(
b64_face_image
.
decode
(
'base64'
))
attempt
.
upload_photo_id_image
(
b64_photo_id_image
.
decode
(
'base64'
))
attempt
.
mark_ready
()
attempt
.
save
()
course_id
=
request
.
POST
[
'course_id'
]
course_id
=
request
.
POST
[
'course_id'
]
course_id
=
CourseKey
.
from_string
(
course_id
)
course_id
=
CourseKey
.
from_string
(
course_id
)
donation_for_course
=
request
.
session
.
get
(
'donation_for_course'
,
{})
donation_for_course
=
request
.
session
.
get
(
'donation_for_course'
,
{})
...
...
lms/static/js/verify_student/views/incourse_reverify_view.js
View file @
5198257c
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
submitPhoto
:
function
()
{
submitPhoto
:
function
()
{
// disable the submit button to prevent multiple submissions.
// disable the submit button to prevent multiple submissions.
this
.
setSubmitButtonEnabled
(
false
)
this
.
setSubmitButtonEnabled
(
false
)
;
this
.
model
.
save
();
this
.
model
.
save
();
},
},
...
...
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