完善会话草稿恢复与附件保留,统一人工服务时区
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Remote dev behavior on the modular backend and the light workspace."""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
import io
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
@@ -50,6 +50,19 @@ class DevIntegrationTests(unittest.TestCase):
|
||||
self.assertEqual(self.client.post('/api/ticket', json={'content': '周末留言'}).json, {'ok': True})
|
||||
self.assertEqual(self.client.get('/api/tickets').json[0]['content'], '周末留言')
|
||||
|
||||
def test_service_hours_use_china_time_even_when_the_host_clock_is_utc(self):
|
||||
cid = self.client.post('/api/new_chat').json['id']
|
||||
for utc_hour, expected in ((0, True),(13, True),(14, False),(23, False)):
|
||||
instant = datetime(2026,10,31,utc_hour,tzinfo=timezone.utc)
|
||||
class HostUtcClock(datetime):
|
||||
@classmethod
|
||||
def now(cls, tz=None):
|
||||
return instant.astimezone(tz) if tz else instant.replace(tzinfo=None)
|
||||
with self.subTest(utc_hour=utc_hour), patch('logistics_chat.human_service.datetime', HostUtcClock):
|
||||
result = self.client.post('/api/visitor/human/request',json={'conv_id':cid}).json
|
||||
self.assertEqual(result['ok'],expected)
|
||||
if not expected: self.assertTrue(result['closed'])
|
||||
|
||||
def test_transfer_returns_to_queue_preserves_messages_and_note(self):
|
||||
sid = self.session()
|
||||
self.client.post('/api/human/accept', json={'sid': sid})
|
||||
|
||||
Reference in New Issue
Block a user