fix(ddic): Data Preview 400 报错携带 SAP 原文 + 纠正 SQL 方言结论(= 需两侧空格,非不支持)

This commit is contained in:
coordinator
2026-09-11 02:00:50 +08:00
parent 53ea2d854d
commit f9d08774fd
6 changed files with 55 additions and 23 deletions
+12 -1
View File
@@ -712,7 +712,18 @@ class TestQueryTableData(unittest.TestCase):
with self.assertRaises(SapCliError) as ctx:
client.query_table_data("SELECT * FROM t WHERE f='x'")
self.assertIn("IN", str(ctx.exception))
self.assertIn("LIKE", str(ctx.exception))
self.assertIn("空格", str(ctx.exception))
def test_http_400_carries_sap_message(self):
"""400 报错必须携带 SAP 原文(如「未知的列名称」),不能只给笼统提示。"""
client = _make_client()
client.session.post.return_value = _mock_resp(
400, text='<exc:exception xmlns:exc="x"><message lang="EN">'
'未知的列名称 "LANGUAGE" until runtime</message></exc:exception>')
with self.assertRaises(SapCliError) as ctx:
client.query_table_data("SELECT LANGUAGE FROM dd02t")
self.assertIn("SAP 原文", str(ctx.exception))
self.assertIn("未知的列名称", str(ctx.exception))
# ═══════════════════════════════════════════