diff --git a/edx_exams/apps/core/management/commands/test/test_bulk_add_course_staff.py b/edx_exams/apps/core/management/commands/test/test_bulk_add_course_staff.py index a8e83e4f..da9229d3 100644 --- a/edx_exams/apps/core/management/commands/test/test_bulk_add_course_staff.py +++ b/edx_exams/apps/core/management/commands/test/test_bulk_add_course_staff.py @@ -73,13 +73,14 @@ def test_add_course_staff_with_not_default_batch_delay(self): def test_num_queries_correct(self): """ - Expect the number of queries to be 3 + 3 * number of lines - - 2 for savepoint/release savepoint, 1 for count check below, 1 to get existing usernames - - 3 for each user, assuming not existing (1 to create user, 1 to get user, 1 to add course role) + Expect the number of queries to be 5 + 1 * number of lines + - 2 for savepoint/release savepoint, 1 to get existing usernames, + - 1 to bulk create users, 1 to bulk create course role + - 1 for each user (to get user) """ num_lines = 20 lines = [f'pam{i},pam{i}@pond.com,staff,course-v1:edx+test+f20\n' for i in range(num_lines)] with NamedTemporaryFile() as csv: csv = self._write_test_csv(csv, lines) - with self.assertNumQueries(3 + 3 * num_lines): + with self.assertNumQueries(5 + num_lines): call_command(self.command, f'--csv_path={csv.name}')