Skip to content
Snippets Groups Projects
Unverified Commit df0f6010 authored by Manjinder Singh's avatar Manjinder Singh Committed by GitHub
Browse files

Merge pull request #21981 from edx/msingh/str_no_decode

py2topy3 conversion: fixing str no decode method errors
parents 69920f27 eceb53c6
No related merge requests found
......@@ -32,7 +32,7 @@ class Command(BaseCommand):
csv_path = options['csv_path']
if csv_path:
with open(csv_path) as csv_file:
with open(csv_path, 'rb') as csv_file:
self.unenroll_users(csv_file)
else:
csv_file = BulkUnenrollConfiguration.current().csv_file
......
......@@ -96,7 +96,7 @@ class BulkUnenrollTests(SharedModuleStoreTestCase):
lines += str(enrollment.user.id) + "," + enrollment.user.username + "," + \
enrollment.user.email + "," + str(enrollment.course.id) + "\n"
csv_file = SimpleUploadedFile(name='test.csv', content=lines, content_type='text/csv')
csv_file = SimpleUploadedFile(name='test.csv', content=lines.encode('utf-8'), content_type='text/csv')
BulkUnenrollConfiguration.objects.create(enabled=True, csv_file=csv_file)
call_command("bulk_unenroll")
......@@ -110,14 +110,14 @@ class BulkUnenrollTests(SharedModuleStoreTestCase):
for enrollment in self.enrollments:
username = enrollment.user.username
if username in users_unenrolled:
users_unenrolled[username].append(str(enrollment.course.id))
users_unenrolled[username].append(str(enrollment.course.id).encode('utf-8'))
else:
users_unenrolled[username] = [str(enrollment.course.id)]
users_unenrolled[username] = [str(enrollment.course.id).encode('utf-8')]
lines += str(enrollment.user.id) + "," + username + "," + \
enrollment.user.email + "," + str(enrollment.course.id) + "\n"
csv_file = SimpleUploadedFile(name='test.csv', content=lines, content_type='text/csv')
csv_file = SimpleUploadedFile(name='test.csv', content=lines.encode('utf-8'), content_type='text/csv')
BulkUnenrollConfiguration.objects.create(enabled=True, csv_file=csv_file)
with LogCapture(LOGGER_NAME) as log:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment