1
0
forked from erp-dev/erp

added image_name to PlateOrder model

This commit is contained in:
2025-11-27 15:14:34 +08:00
parent a9c75a13fa
commit 0fa153849c
12 changed files with 108 additions and 432 deletions

View File

@@ -72,7 +72,7 @@ class SSEAPITestCase(TestCase):
response = self.client.get('/sse/')
self.assertEqual(response.status_code, 403)
self.assertEqual(response.content, b'\u8ba4\u8bc1\u5931\u8d25\u6216\u6216\u7528\u6237\u6237')
self.assertEqual(response.content, b'Authentication failed or user has no associated merchant')
# 检查连接未被添加到服务中
self.assertEqual(len(services._connections), 0)
@@ -85,7 +85,7 @@ class SSEAPITestCase(TestCase):
)
self.assertEqual(response.status_code, 403)
self.assertEqual(response.content, b'\u8ba4\u8bc1\u5931\u8d25\u6216\u6216\u7528\u6237\u6237')
self.assertEqual(response.content, b'Authentication failed or user has no associated merchant')
# 检查连接未被添加到服务中
self.assertEqual(len(services._connections), 0)
@@ -98,7 +98,7 @@ class SSEAPITestCase(TestCase):
)
self.assertEqual(response.status_code, 403)
self.assertEqual(response.content, b'\u8ba4\u8bc1\u5931\u8d25\u6216\u6216\u7528\u6237\u6237')
self.assertEqual(response.content, b'Authentication failed or user has no associated merchant')
# 检查连接未被添加到服务中
self.assertEqual(len(services._connections), 0)
@@ -140,7 +140,7 @@ class SSEAPITestCase(TestCase):
self.assertEqual(response.status_code, 403)
data = response.json()
self.assertEqual(data['error'], '用户无关联商户')
self.assertEqual(data['error'], 'User has no associated merchant')
def test_get_sse_status(self):
"""测试获取SSE状态"""
@@ -190,7 +190,7 @@ class SSEAPITestCase(TestCase):
self.assertEqual(response.status_code, 200)
data = response.json()
self.assertEqual(data['status'], 'ok')
self.assertEqual(data['message'], 'Shutdown signal sent to your merchant\'s SSE connections')
self.assertEqual(data['message'], 'Your merchant\'s SSE connections have been closed')
self.assertEqual(data['merchant_id'], self.merchant1.id)
self.assertEqual(data['clients'], 1)
@@ -260,13 +260,18 @@ class SSEAPITestCase(TestCase):
"""测试OPTIONS预检请求"""
response = self.client.options('/sse/')
# OPTIONS请求应该成功返回CORS头
# OPTIONS请求应该成功
self.assertEqual(response.status_code, 200)
# 检查CORS头
self.assertIn('Access-Control-Allow-Origin', response)
self.assertIn('Access-Control-Allow-Methods', response)
self.assertIn('Access-Control-Allow-Headers', response)
# 带Origin头的OPTIONS请求应该返回CORS头
response_with_origin = self.client.options(
'/sse/',
HTTP_ORIGIN='https://example.com'
)
self.assertEqual(response_with_origin.status_code, 200)
self.assertIn('Access-Control-Allow-Origin', response_with_origin)
self.assertIn('Access-Control-Allow-Methods', response_with_origin)
self.assertIn('Access-Control-Allow-Headers', response_with_origin)
class SSEServicesTestCase(TestCase):