mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
test #459: fix failing datetime and date logic tests
This commit is contained in:
@@ -22,19 +22,21 @@ def test_datetime() -> None:
|
|||||||
response = client.get("/datetime")
|
response = client.get("/datetime")
|
||||||
assert response.headers.get("X-FastAPI-Cache") == "MISS"
|
assert response.headers.get("X-FastAPI-Cache") == "MISS"
|
||||||
now = response.json().get("now")
|
now = response.json().get("now")
|
||||||
now_ = pendulum.now()
|
# now_ = pendulum.now()
|
||||||
assert pendulum.parse(now) == now_
|
# assert pendulum.parse(now) == now_
|
||||||
|
now_ = pendulum.parse(now)
|
||||||
response = client.get("/datetime")
|
response = client.get("/datetime")
|
||||||
assert response.headers.get("X-FastAPI-Cache") == "HIT"
|
assert response.headers.get("X-FastAPI-Cache") == "HIT"
|
||||||
now = response.json().get("now")
|
now = response.json().get("now")
|
||||||
assert pendulum.parse(now) == now_
|
assert pendulum.parse(now) == now_
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
response = client.get("/datetime")
|
response = client.get("/datetime")
|
||||||
now = response.json().get("now")
|
# now = response.json().get("now")
|
||||||
assert response.headers.get("X-FastAPI-Cache") == "MISS"
|
assert response.headers.get("X-FastAPI-Cache") == "MISS"
|
||||||
|
now = response.json().get("now")
|
||||||
now = pendulum.parse(now)
|
now = pendulum.parse(now)
|
||||||
assert now != now_
|
assert now != now_
|
||||||
assert now == pendulum.now()
|
# assert now == pendulum.now()
|
||||||
|
|
||||||
|
|
||||||
def test_date() -> None:
|
def test_date() -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user