test_data_rule_frontend_contract.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. from pathlib import Path
  2. API = Path("frontend/src/api/dataRules.js")
  3. AUTHORING = Path("frontend/src/components/DataRules/RuleAuthoringPanel.vue")
  4. STANDARD = Path(
  5. "frontend/src/views/dataGovernance/dataStandard/components/edit.vue"
  6. )
  7. DATAFLOW = Path(
  8. "frontend/src/views/dataGovernance/dataProcess/components/edit.vue"
  9. )
  10. FACTORY = Path(
  11. "frontend/src/views/dataFactory/workflow/ProductionLineDeployment.vue"
  12. )
  13. FACTORY_INDEX = Path("frontend/src/views/dataFactory/workflow/index.vue")
  14. def test_rule_api_client_exposes_versions_publish_and_server_side_release():
  15. source = API.read_text(encoding="utf-8")
  16. assert "http.get('/rules/capabilities')" in source
  17. assert "http.post('/rules/interpret'" in source
  18. assert "http.post('/rules/validate'" in source
  19. assert "http.post('/rules/production-lines/resolve'" in source
  20. assert "http.post('/rules/rule-versions'" in source
  21. assert "http.post(`/rules/rule-versions/${versionId}/publish`)" in source
  22. assert "http.post('/rules/standard-versions'" in source
  23. assert "http.post(`/rules/standard-versions/${versionId}/publish`)" in source
  24. assert "http.post(`/rules/production-lines/${dataflowUid}/release`" in source
  25. assert "/activate" not in source
  26. def test_reusable_authoring_panel_preserves_human_review_gate():
  27. source = AUTHORING.read_text(encoding="utf-8")
  28. assert "authoringSurface" in source
  29. assert "interpretRule" in source
  30. assert "clarification_required" in source
  31. assert "$emit('candidate'" in source
  32. assert "createRuleVersion" in source
  33. assert "createStandardVersion" in source
  34. assert "publishRuleVersion" in source
  35. assert "rules:publish" in source
  36. assert "$emit('version'" in source
  37. assert "自动执行" not in source
  38. def test_standard_and_dataflow_both_embed_ai_rule_authoring():
  39. standard = STANDARD.read_text(encoding="utf-8")
  40. dataflow = DATAFLOW.read_text(encoding="utf-8")
  41. assert 'authoring-surface="data_standard"' in standard
  42. assert "handleRuleCandidate" in standard
  43. assert '@version="handleRuleVersion"' in standard
  44. assert 'authoring-surface="data_flow"' in dataflow
  45. assert "handleRuleCandidate" in dataflow
  46. assert '@version="handleRuleVersion"' in dataflow
  47. assert "rule_spec" in dataflow
  48. def test_data_factory_exposes_release_ready_but_no_fake_activation():
  49. page = FACTORY.read_text(encoding="utf-8")
  50. index = FACTORY_INDEX.read_text(encoding="utf-8")
  51. assert "数据生产线投产" in page
  52. assert "getRuleCapabilities" in page
  53. assert "production_line_release" in page
  54. assert "data_factory_activation" in page
  55. assert "发布版本" in page
  56. assert "执行计划" in page
  57. assert "发布与执行计划已经可用" in page
  58. assert "投产激活仍保持关闭" in page
  59. assert "ProductionLineDeployment" in index