Skip to content

Commit

Permalink
test: update num queries for bulk
Browse files Browse the repository at this point in the history
  • Loading branch information
varshamenon4 committed Mar 28, 2024
1 parent 85ca2ba commit 9dd39c7
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}')

0 comments on commit 9dd39c7

Please sign in to comment.