Skip to content

Commit

Permalink
Fix test_cookie_expires (#2481)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihweiLHBird committed Jun 19, 2022
1 parent b8c7109 commit 85f1154
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_cookies.py
Expand Up @@ -223,17 +223,17 @@ def handler(request):


@pytest.mark.parametrize(
"expires", [datetime.utcnow() + timedelta(seconds=60)]
"expires", [timedelta(seconds=60)]
)
def test_cookie_expires(app: Sanic, expires: datetime):
expires = expires.replace(microsecond=0)
def test_cookie_expires(app: Sanic, expires: timedelta):
expires_time = datetime.utcnow().replace(microsecond=0) + expires
cookies = {"test": "wait"}

@app.get("/")
def handler(request):
response = text("pass")
response.cookies["test"] = "pass"
response.cookies["test"]["expires"] = expires
response.cookies["test"]["expires"] = expires_time
return response

request, response = app.test_client.get(
Expand All @@ -246,7 +246,7 @@ def handler(request):

assert response.status == 200
assert response.cookies["test"] == "pass"
assert cookie_expires == expires
assert cookie_expires == expires_time


@pytest.mark.parametrize("expires", ["Fri, 21-Dec-2018 15:30:00 GMT"])
Expand Down

0 comments on commit 85f1154

Please sign in to comment.