Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Findeton committed Jul 19, 2023
1 parent fbfcc8f commit 3890b1d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions iam/authmethods/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ def _test_resend_auth_codes(

# Check that the number of codes associated with this voter did not
# change
expected_count = initial_codes_count + 2 if is_otp else initial_codes_count
expected_count = expected_count + 1 if is_otp else initial_codes_count
self.assertEqual(voter.userdata.codes.count(), expected_count)

auth_event.auth_method_config['config']['allow_user_resend'] = True
Expand All @@ -1342,7 +1342,8 @@ def _test_resend_auth_codes(
self.assertEqual(response.status_code, 200)

# Check that there's still one more new code associated with this voter
self.assertEqual(voter.userdata.codes.count(), initial_codes_count + 1)
expected_count = expected_count + 1 if is_otp else initial_codes_count + 1
self.assertEqual(voter.userdata.codes.count(), expected_count)

# get the code and authenticate with it
code = voter.userdata.codes.order_by('-created')[0]
Expand All @@ -1367,7 +1368,9 @@ def _test_resend_auth_codes(
resend_auth_codes_data
)
self.assertEqual(response.status_code, 200)
self.assertEqual(voter.userdata.codes.count(), initial_codes_count + 2)

expected_count = expected_count + 1 if is_otp else initial_codes_count + 2
self.assertEqual(voter.userdata.codes.count(), expected_count)
code = voter.userdata.codes.order_by('-created')[0]
credentials['code'] = code.code
response = client.authenticate(auth_event.id, credentials)
Expand Down

0 comments on commit 3890b1d

Please sign in to comment.