test #459: fix failing datetime and date logic tests

This commit is contained in:
Gary Gale
2025-01-17 16:20:43 +00:00
parent 06f4a09d6c
commit b2e7bad0bb

View File

@@ -22,19 +22,21 @@ def test_datetime() -> None:
response = client.get("/datetime")
assert response.headers.get("X-FastAPI-Cache") == "MISS"
now = response.json().get("now")
now_ = pendulum.now()
assert pendulum.parse(now) == now_
# now_ = pendulum.now()
# assert pendulum.parse(now) == now_
now_ = pendulum.parse(now)
response = client.get("/datetime")
assert response.headers.get("X-FastAPI-Cache") == "HIT"
now = response.json().get("now")
assert pendulum.parse(now) == now_
time.sleep(3)
response = client.get("/datetime")
now = response.json().get("now")
# now = response.json().get("now")
assert response.headers.get("X-FastAPI-Cache") == "MISS"
now = response.json().get("now")
now = pendulum.parse(now)
assert now != now_
assert now == pendulum.now()
# assert now == pendulum.now()
def test_date() -> None: