fix(time): report Beijing wall clock independently of server timezone

This commit is contained in:
ex_tianzy
2026-11-05 22:58:04 +08:00
parent e4c3a8ad4e
commit 8d0c82385b
2 changed files with 19 additions and 2 deletions
+17
View File
@@ -0,0 +1,17 @@
from datetime import datetime, timedelta, timezone
from relay import work_client
def test_legacy_status_is_beijing_even_on_utc_host(monkeypatch):
class Clock:
@staticmethod
def now(tz=None):
instant=datetime(2026,11,5,17,30,tzinfo=timezone.utc)
return instant.astimezone(tz) if tz else instant
monkeypatch.setattr(work_client,'datetime',Clock)
client=object.__new__(work_client.WorkClient)
client.owner='synthetic-owner'
client.access_token=lambda:'synthetic-token'
result=client.status()
assert result['local_time']=='2026-11-06T01:30:00+08:00'
assert 'synthetic-token' not in str(result)