-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cabfa59
commit 38b57fe
Showing
1 changed file
with
4 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ def _write_test_csv(self, csv, lines): | |
return csv | ||
|
||
def _assert_user_and_role(self, username, email, course_role, course_id): | ||
""" Helper that asserts that User and CourseStaffRole are created """ | ||
user = User.objects.filter(username=username, email=email) | ||
assert user.exists() | ||
assert CourseStaffRole.objects.filter( | ||
|
@@ -67,9 +68,7 @@ def test_add_course_staff_with_new_user(self): | |
self._assert_user_and_role(username, email, self.course_role, self.course_id) | ||
|
||
def test_add_course_staff_multiple(self): | ||
""" | ||
Assert that the course staff role is correct given multiple lines | ||
""" | ||
""" Assert that the course staff role is correct given multiple lines """ | ||
username, email = 'pam', '[email protected]' | ||
username2, email2 = 'cam', '[email protected]' | ||
lines = [f'{username},{email},{self.course_role},{self.course_id}\n', | ||
|
@@ -81,14 +80,12 @@ def test_add_course_staff_multiple(self): | |
self._assert_user_and_role(username2, email2, self.course_role, self.course_id) | ||
|
||
def test_add_course_staff_with_not_default_batch_size(self): | ||
""" | ||
Assert that the number of queries is correct given 2 batches | ||
""" | ||
""" Assert that the number of queries is correct given 2 batches """ | ||
lines = ['pam,[email protected],staff,course-v1:edx+test+f20\n', | ||
'sam,[email protected],staff,course-v1:edx+test+f20\n'] | ||
with NamedTemporaryFile() as csv: | ||
csv = self._write_test_csv(csv, lines) | ||
with self.assertNumQueries(10): | ||
with self.assertNumQueries(9): | ||
call_command(self.command, f'--csv_path={csv.name}', '--batch_size=1') | ||
|
||
def test_add_course_staff_with_not_default_batch_delay(self): | ||
|