Commit 5198257c by Will Daly

Merge pull request #8461 from edx/will/verify-student-cleanup

Remove unused code left over from ECOM-188.
parents 4dd55609 69306da4
...@@ -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")
......
...@@ -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)
......
...@@ -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', {})
......
...@@ -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();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment