@@ -433,41 +433,41 @@ def test_clear_expired_tokens_with_tokens(self):
433
433
initial_at_count = AccessToken .objects .count ()
434
434
assert initial_at_count == 2 * self .num_tokens , f"{ 2 * self .num_tokens } access tokens should exist."
435
435
initial_expired_at_count = AccessToken .objects .filter (expires__lte = self .now ).count ()
436
- assert (
437
- initial_expired_at_count == self .num_tokens
438
- ), f" { self . num_tokens } expired access tokens should exist."
436
+ assert initial_expired_at_count == self . num_tokens , (
437
+ f" { self .num_tokens } expired access tokens should exist."
438
+ )
439
439
initial_current_at_count = AccessToken .objects .filter (expires__gt = self .now ).count ()
440
- assert (
441
- initial_current_at_count == self .num_tokens
442
- ), f" { self . num_tokens } current access tokens should exist."
440
+ assert initial_current_at_count == self . num_tokens , (
441
+ f" { self .num_tokens } current access tokens should exist."
442
+ )
443
443
initial_rt_count = RefreshToken .objects .count ()
444
- assert (
445
- initial_rt_count == self .num_tokens // 2
446
- ), f" { self . num_tokens // 2 } refresh tokens should exist."
444
+ assert initial_rt_count == self . num_tokens // 2 , (
445
+ f" { self .num_tokens // 2 } refresh tokens should exist."
446
+ )
447
447
initial_rt_expired_at_count = RefreshToken .objects .filter (access_token__expires__lte = self .now ).count ()
448
- assert (
449
- initial_rt_expired_at_count == initial_rt_count / 2
450
- ), "half the refresh tokens should be for expired access tokens."
448
+ assert initial_rt_expired_at_count == initial_rt_count / 2 , (
449
+ "half the refresh tokens should be for expired access tokens."
450
+ )
451
451
initial_rt_current_at_count = RefreshToken .objects .filter (access_token__expires__gt = self .now ).count ()
452
- assert (
453
- initial_rt_current_at_count == initial_rt_count / 2
454
- ), "half the refresh tokens should be for current access tokens."
452
+ assert initial_rt_current_at_count == initial_rt_count / 2 , (
453
+ "half the refresh tokens should be for current access tokens."
454
+ )
455
455
initial_gt_count = Grant .objects .count ()
456
456
assert initial_gt_count == self .num_tokens * 2 , f"{ self .num_tokens * 2 } grants should exist."
457
457
458
458
clear_expired ()
459
459
460
460
# after clear_expired():
461
461
remaining_at_count = AccessToken .objects .count ()
462
- assert (
463
- remaining_at_count == initial_at_count // 2
464
- ), "half the initial access tokens should still exist."
462
+ assert remaining_at_count == initial_at_count // 2 , (
463
+ "half the initial access tokens should still exist."
464
+ )
465
465
remaining_expired_at_count = AccessToken .objects .filter (expires__lte = self .now ).count ()
466
466
assert remaining_expired_at_count == 0 , "no remaining expired access tokens should still exist."
467
467
remaining_current_at_count = AccessToken .objects .filter (expires__gt = self .now ).count ()
468
- assert (
469
- remaining_current_at_count == initial_current_at_count
470
- ), "all current access tokens should still exist."
468
+ assert remaining_current_at_count == initial_current_at_count , (
469
+ "all current access tokens should still exist."
470
+ )
471
471
remaining_rt_count = RefreshToken .objects .count ()
472
472
assert remaining_rt_count == initial_rt_count // 2 , "half the refresh tokens should still exist."
473
473
remaining_rt_expired_at_count = RefreshToken .objects .filter (
@@ -477,9 +477,9 @@ def test_clear_expired_tokens_with_tokens(self):
477
477
remaining_rt_current_at_count = RefreshToken .objects .filter (
478
478
access_token__expires__gt = self .now
479
479
).count ()
480
- assert (
481
- remaining_rt_current_at_count == initial_rt_current_at_count
482
- ), "all the refresh tokens for current access tokens should still exist."
480
+ assert remaining_rt_current_at_count == initial_rt_current_at_count , (
481
+ "all the refresh tokens for current access tokens should still exist."
482
+ )
483
483
remaining_gt_count = Grant .objects .count ()
484
484
assert remaining_gt_count == initial_gt_count // 2 , "half the remaining grants should still exist."
485
485
0 commit comments