From 2244540ade5e57839eb893b73e06c552cde1dd3c Mon Sep 17 00:00:00 2001 From: Ayub khan Date: Tue, 6 Aug 2019 17:16:08 +0500 Subject: [PATCH] BOM-78 Update uuid4().hex.decode(ascii) calls --- common/djangoapps/student/tests/factories.py | 2 +- lms/djangoapps/commerce/api/v0/tests/test_views.py | 4 ++-- lms/djangoapps/verify_student/tests/test_views.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/djangoapps/student/tests/factories.py b/common/djangoapps/student/tests/factories.py index 280695bd9a..90d4f30a79 100644 --- a/common/djangoapps/student/tests/factories.py +++ b/common/djangoapps/student/tests/factories.py @@ -69,7 +69,7 @@ class RegistrationFactory(DjangoModelFactory): model = Registration user = None - activation_key = uuid4().hex.decode('ascii') + activation_key = six.text_type(uuid4().hex) class UserFactory(DjangoModelFactory): diff --git a/lms/djangoapps/commerce/api/v0/tests/test_views.py b/lms/djangoapps/commerce/api/v0/tests/test_views.py index ac3cb21784..2cd9ebfac5 100644 --- a/lms/djangoapps/commerce/api/v0/tests/test_views.py +++ b/lms/djangoapps/commerce/api/v0/tests/test_views.py @@ -78,7 +78,7 @@ class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase) # TODO Verify this is the best method to create CourseMode objects. # TODO Find/create constants for the modes. for mode in [CourseMode.HONOR, CourseMode.VERIFIED, CourseMode.AUDIT]: - sku_string = uuid4().hex.decode('ascii') + sku_string = six.text_type(uuid4().hex) CourseModeFactory.create( course_id=self.course.id, mode_slug=mode, @@ -200,7 +200,7 @@ class BasketsViewTests(EnrollmentEventTestMixin, UserMixin, ModuleStoreTestCase) CourseMode.objects.filter(course_id=self.course.id).delete() mode = CourseMode.NO_ID_PROFESSIONAL_MODE - sku_string = uuid4().hex.decode('ascii') + sku_string = six.text_type(uuid4().hex) CourseModeFactory.create(course_id=self.course.id, mode_slug=mode, mode_display_name=mode, sku=sku_string, bulk_sku='BULK-{}'.format(sku_string)) response = self._post_to_view() diff --git a/lms/djangoapps/verify_student/tests/test_views.py b/lms/djangoapps/verify_student/tests/test_views.py index 5694e942aa..d2bd5c764b 100644 --- a/lms/djangoapps/verify_student/tests/test_views.py +++ b/lms/djangoapps/verify_student/tests/test_views.py @@ -1255,7 +1255,7 @@ class TestCreateOrderEcommerceService(CheckoutTestMixin, ModuleStoreTestCase): def make_sku(self): """ Checkout is handled by the ecommerce service when the course mode's sku is nonempty. """ - return uuid4().hex.decode('ascii') + return six.text_type(uuid4().hex) def _get_checkout_args(self, patched_create_order): """ Assuming patched_create_order was called, return a mapping containing the call arguments."""