Skip to content
Snippets Groups Projects
Commit 7d8d9431 authored by Awais Jibran's avatar Awais Jibran
Browse files

Update tests

parent ee4aca65
No related merge requests found
......@@ -37,7 +37,7 @@ class Command(BaseCommand):
'-p', '--csv_path',
metavar='csv_path',
dest='csv_path',
required=True,
required=False,
help='Path to CSV file.')
parser.add_argument(
'--commit',
......
......@@ -58,7 +58,7 @@ class BulkUnenrollTests(SharedModuleStoreTestCase):
csv = self._write_test_csv(csv, lines=["amy,test_course\n"])
with LogCapture(LOGGER_NAME) as log:
call_command("bulk_unenroll", "--csv_path={} --commit".format(csv.name))
call_command("bulk_unenroll", "--csv_path={}".format(csv.name), "--commit")
expected_message = 'Invalid course id {}, skipping un-enrollement.'.\
format('test_course')
......@@ -76,7 +76,7 @@ class BulkUnenrollTests(SharedModuleStoreTestCase):
with NamedTemporaryFile() as csv:
csv = self._write_test_csv(csv, lines=lines)
call_command("bulk_unenroll", "--csv_path={} --commit".format(csv.name))
call_command("bulk_unenroll", "--csv_path={}".format(csv.name), "--commit")
for enrollment in CourseEnrollment.objects.all():
self.assertEqual(enrollment.is_active, False)
......@@ -106,7 +106,7 @@ class BulkUnenrollTests(SharedModuleStoreTestCase):
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 --commit")
call_command("bulk_unenroll", "--commit")
for enrollment in CourseEnrollment.objects.all():
self.assertEqual(enrollment.is_active, False)
......@@ -117,14 +117,20 @@ class BulkUnenrollTests(SharedModuleStoreTestCase):
csv_file = SimpleUploadedFile(name='test.csv', content=lines.encode('utf-8'), content_type='text/csv')
BulkUnenrollConfiguration.objects.create(enabled=True, csv_file=csv_file)
course_id = self.enrollments[0].course.id
with LogCapture(LOGGER_NAME) as log:
call_command("bulk_unenroll --commit")
call_command("bulk_unenroll", "--commit")
log.check(
(
LOGGER_NAME,
'INFO',
'Processing [{}] with [1] enrollments.'.format(course_id),
),
(
LOGGER_NAME,
'INFO',
'User [{}] have been successfully unenrolled from the course: {}'.format(
self.enrollments[0].username, self.enrollments[0].course.id
)
)
),
)
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