From 1bb50088dcb850e77ca2c33237ec6d5ffed349eb Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Wed, 7 Aug 2019 17:21:11 -0400 Subject: [PATCH] More test collection fixes. --- lms/djangoapps/dashboard/tests/test_sysadmin.py | 10 +++++----- .../learner_dashboard/tests/test_programs.py | 2 +- lms/djangoapps/verify_student/tests/test_ssencrypt.py | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lms/djangoapps/dashboard/tests/test_sysadmin.py b/lms/djangoapps/dashboard/tests/test_sysadmin.py index 7c5ff323af..3e1d12fe97 100644 --- a/lms/djangoapps/dashboard/tests/test_sysadmin.py +++ b/lms/djangoapps/dashboard/tests/test_sysadmin.py @@ -183,11 +183,11 @@ class TestSysAdminMongoCourseImport(SysadminBaseTestCase): # Regex of first 3 columns of course information table row for # test course loaded from git. Would not have sha1 if # git_info_for_course failed. - table_re = re.compile(ur""" - \s+ - edX\sAuthor\sCourse\s+ # expected test git course name - course-v1:MITx\+edx4edx\+edx4edx\s+ # expected test git course_id - [a-fA-F\d]{40} # git sha1 hash + table_re = re.compile(u""" + \\s+ + edX\\sAuthor\\sCourse\\s+ # expected test git course name + course-v1:MITx\\+edx4edx\\+edx4edx\\s+ # expected test git course_id + [a-fA-F\\d]{40} # git sha1 hash """, re.VERBOSE) self._setstaff_login() self._mkdir(settings.GIT_REPO_DIR) diff --git a/lms/djangoapps/learner_dashboard/tests/test_programs.py b/lms/djangoapps/learner_dashboard/tests/test_programs.py index 2332b2460b..5a300de3e9 100644 --- a/lms/djangoapps/learner_dashboard/tests/test_programs.py +++ b/lms/djangoapps/learner_dashboard/tests/test_programs.py @@ -39,7 +39,7 @@ def load_serialized_data(response, key): """ Extract and deserialize serialized data from the response. """ - pattern = re.compile(ur'{key}: (?P\[.*\])'.format(key=key)) + pattern = re.compile(u'{key}: (?P\\[.*\\])'.format(key=key)) match = pattern.search(response.content) serialized = match.group('data') diff --git a/lms/djangoapps/verify_student/tests/test_ssencrypt.py b/lms/djangoapps/verify_student/tests/test_ssencrypt.py index 6e39b08c12..52b4d065b9 100644 --- a/lms/djangoapps/verify_student/tests/test_ssencrypt.py +++ b/lms/djangoapps/verify_student/tests/test_ssencrypt.py @@ -5,6 +5,7 @@ Tests of the encryption and decryption utilities in the ssencrypt module. from __future__ import absolute_import import base64 +import binascii from lms.djangoapps.verify_student.ssencrypt import ( aes_decrypt, @@ -15,7 +16,7 @@ from lms.djangoapps.verify_student.ssencrypt import ( rsa_encrypt ) -AES_KEY_BYTES = b'32fe72aaf2abb44de9e161131b5435c8d37cbdb6f5df242ae860b283115f2dae'.decode('hex') +AES_KEY_BYTES = binascii.unhexlify(b'32fe72aaf2abb44de9e161131b5435c8d37cbdb6f5df242ae860b283115f2dae') # Make up some garbage keys for testing purposes. PUB_KEY_BYTES = b"""-----BEGIN PUBLIC KEY-----