mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 05:30:46 +08:00
Show original field names in biz-state workbook headers.
Stop using Chinese display_name for metric sheet columns so headers match the raw field keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
ee375b144d
commit
b6eab3ed8f
3 changed files with 24 additions and 2 deletions
|
|
@ -77,6 +77,27 @@ class BatchWorkbookApiTests(unittest.TestCase):
|
|||
list_batch_metric_rows(db, "b1", "commands")
|
||||
self.assertEqual(ctx.exception.status_code, 400)
|
||||
|
||||
def test_metric_columns_use_original_field_names(self) -> None:
|
||||
batch = BizStateBatch(id="b1", task_id="t1", status="ok")
|
||||
db = MagicMock()
|
||||
db.get.return_value = batch
|
||||
q = MagicMock()
|
||||
q.filter.return_value = q
|
||||
q.count.return_value = 0
|
||||
q.order_by.return_value.offset.return_value.limit.return_value.all.return_value = []
|
||||
db.query.return_value = q
|
||||
|
||||
out = list_batch_metric_rows(db, "b1", "interface_detail", page=1, page_size=10)
|
||||
self.assertTrue(out["columns"])
|
||||
for col in out["columns"]:
|
||||
self.assertEqual(col["key"], col["header"])
|
||||
# Must not surface Chinese display_name as header
|
||||
self.assertNotIn("接口", col["header"])
|
||||
self.assertNotIn("描述", col["header"])
|
||||
keys = {c["key"] for c in out["columns"]}
|
||||
self.assertIn("interface", keys)
|
||||
self.assertIn("description", keys)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue