Skip to content

Commit

Permalink
fix: [#554] fixed tests/test_session.py::test_token_cookie_expires ds…
Browse files Browse the repository at this point in the history
…t issue
  • Loading branch information
mavwolverine committed Jan 1, 2025
1 parent f1b9103 commit aa75013
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# under the License.

import asyncio
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, List, Optional
from unittest.mock import MagicMock

Expand Down Expand Up @@ -664,13 +664,13 @@ async def test_token_cookie_expires(
if c.name == "sAccessToken": # 100 years (set by the SDK)
# some time must have elasped since the cookie was set. So less than current time
assert (
datetime.fromtimestamp(c.expires or 0) - timedelta(days=365.25 * 100)
< datetime.now()
datetime.fromtimestamp(c.expires or 0, tz=timezone.utc) - timedelta(days=365.25 * 100)
< datetime.now(tz=timezone.utc)
)
if c.name == "sRefreshToken": # 100 days (set by the core)
assert (
datetime.fromtimestamp(c.expires or 0) - timedelta(days=100)
< datetime.now()
datetime.fromtimestamp(c.expires or 0, tz=timezone.utc) - timedelta(days=100)
< datetime.now(tz=timezone.utc)
)

assert response.headers["anti-csrf"] != ""
Expand All @@ -694,13 +694,13 @@ async def test_token_cookie_expires(
if c.name == "sAccessToken": # 100 years (set by the SDK)
# some time must have elasped since the cookie was set. So less than current time
assert (
datetime.fromtimestamp(c.expires or 0) - timedelta(days=365.25 * 100)
< datetime.now()
datetime.fromtimestamp(c.expires or 0, tz=timezone.utc) - timedelta(days=365.25 * 100)
< datetime.now(tz=timezone.utc)
)
if c.name == "sRefreshToken": # 100 days (set by the core)
assert (
datetime.fromtimestamp(c.expires or 0) - timedelta(days=100)
< datetime.now()
datetime.fromtimestamp(c.expires or 0, tz=timezone.utc) - timedelta(days=100)
< datetime.now(tz=timezone.utc)
)

assert response.headers["anti-csrf"] != ""
Expand Down

0 comments on commit aa75013

Please sign in to comment.