File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
from django .contrib .auth import get_user_model
6
6
from django .test import TestCase
7
+ from freezegun import freeze_time
7
8
from jose import jwt
8
9
9
10
from rest_framework_simplejwt .exceptions import (
@@ -434,10 +435,13 @@ def test_init(self):
434
435
435
436
def test_access_token (self ):
436
437
# Should create an access token from a refresh token
437
- refresh = RefreshToken ()
438
- refresh ["test_claim" ] = "arst"
438
+ with freeze_time ("2025-01-01" ):
439
+ refresh = RefreshToken ()
440
+ refresh ["test_claim" ] = "arst"
439
441
440
- access = refresh .access_token
442
+ with freeze_time ("2025-01-02" ):
443
+ # Ensure iat is different
444
+ access = refresh .access_token
441
445
442
446
self .assertIsInstance (access , AccessToken )
443
447
self .assertEqual (access [api_settings .TOKEN_TYPE_CLAIM ], "access" )
You can’t perform that action at this time.
0 commit comments