python2 tests failures.
This commit is contained in:
arbisoft
2019-08-27 16:57:54 +05:00
parent 5012ed6ea4
commit 5a2114ac6c
3 changed files with 3 additions and 3 deletions

View File

@@ -520,7 +520,7 @@ def generate_random_string(length):
if char not in 'aAeEiIoOuU1l'
]
return string.join((random.choice(chars) for __ in range(length)), '')
return ''.join((random.choice(chars) for i in range(length)))
def generate_unique_password(generated_passwords, password_length=12):

View File

@@ -321,5 +321,5 @@ class DjangoStorageReportStore(ReportStore):
"""
Return the full path to a given file for a given course.
"""
hashed_course_id = hashlib.sha1(text_type(course_id)).hexdigest()
hashed_course_id = hashlib.sha1(text_type(course_id).encode('utf-8')).hexdigest()
return os.path.join(hashed_course_id, filename)

View File

@@ -1367,7 +1367,7 @@ class TestExecutiveSummaryReport(TestReportMixin, InstructorTaskCourseTestCase):
report_html_filename = report_store.links_for(self.course.id)[0][0]
report_path = report_store.path_to(self.course.id, report_html_filename)
with report_store.storage.open(report_path) as html_file:
html_file_data = html_file.read()
html_file_data = html_file.read().decode('utf-8')
for data in expected_data:
self.assertIn(data, html_file_data)