Skip to content

Commit

Permalink
Fix test about timestamp problem in windows 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Tracy.Wu committed Jul 2, 2021
1 parent 061a0d4 commit a76a033
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/test_oidc_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,17 @@ def construct_jwt(
msg: Dict[str, Any] = None,
headers: Optional[Dict] = None,
):
iat = datetime.datetime.utcnow()
exp = datetime.datetime.utcnow() + datetime.timedelta(
days=1000000
) # This or patch jwt.decode
iat = datetime.datetime.utcnow().timestamp()
delta_day = 1000000 # Unit: day
# This or patch jwt.decode
if not msg:
msg = {
"name": "John Doe",
"aud": "example-client",
"jti": "68f7cf57-110d-4cbf-9f29-0f5ad4c90328",
"sub": "test-sub",
"iat": int(iat.timestamp()),
"exp": int(exp.timestamp()),
"iat": int(iat),
"exp": int(iat + 3600 * 24 * delta_day),
}
if algorithm == "HS256":
return jwt.encode(msg, "secret", algorithm=algorithm), msg
Expand Down

0 comments on commit a76a033

Please sign in to comment.