Fixed registered field having wrong timezone

This happened with at least Postgres, which took it's server's timezone. It's complicated. Let's just set it from our side instead where we have some control.
This commit is contained in:
Donkie
2023-10-02 21:36:44 +02:00
parent 205574fa2c
commit 9595aec675
6 changed files with 21 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
"""Integration tests for the Filament API endpoint."""
from datetime import datetime, timezone
from typing import Any
import httpx
@@ -62,6 +63,10 @@ def test_add_filament(random_vendor: dict[str, Any]):
"color_hex": color_hex,
}
# Verify that registered happened almost now (within 1 minute)
diff = abs((datetime.now(tz=timezone.utc) - datetime.fromisoformat(filament["registered"])).total_seconds())
assert diff < 60
# Clean up
httpx.delete(f"{URL}/api/v1/filament/{filament['id']}").raise_for_status()