bpmax-cli 0.1.43 → 0.1.44-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/bin.js +3397 -433
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-api-platform-editor/SKILL.md +321 -0
- package/skills/bpmax-api-platform-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +34 -0
- package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +41 -0
- package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +41 -0
- package/skills/bpmax-api-platform-editor/references/platform-api-map.md +52 -0
- package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +32 -0
- package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +1276 -0
- package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +64 -0
- package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +40 -0
- package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +212 -0
- package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +62 -0
- package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +75 -0
- package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +287 -0
- package/skills/bpmax-auth/SKILL.md +6 -17
- package/skills/bpmax-builder-shared/SKILL.md +44 -0
- package/skills/bpmax-builder-shared/base_url.py +81 -0
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +71 -0
- package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +34 -0
- package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +123 -0
- package/skills/bpmax-builder-shared/runtime_script_rules.py +272 -0
- package/skills/bpmax-builder-shared/skill_audit.py +374 -0
- package/skills/bpmax-builder-shared/template_script_hard_rules.py +280 -0
- package/skills/bpmax-builder-shared/tests/test_base_url.py +80 -0
- package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +115 -0
- package/skills/bpmax-builder-shared/tests/test_skill_audit.py +231 -0
- package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +281 -0
- package/skills/bpmax-cli/SKILL.md +2 -0
- package/skills/bpmax-config-latest/SKILL.md +71 -0
- package/skills/bpmax-console-template-editor/SKILL.md +536 -0
- package/skills/bpmax-console-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-console-template-editor/references/filter-integration.md +60 -0
- package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +114 -0
- package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +69 -0
- package/skills/bpmax-console-template-editor/references/module-catalog.md +100 -0
- package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +91 -0
- package/skills/bpmax-console-template-editor/references/template-shape.md +149 -0
- package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +33 -0
- package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +964 -0
- package/skills/bpmax-console-template-editor/scripts/export_console_template.py +99 -0
- package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +46 -0
- package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +99 -0
- package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +383 -0
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +600 -0
- package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +25 -0
- package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +35 -0
- package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +24 -0
- package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +61 -0
- package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +27 -0
- package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +127 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +67 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +37 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +784 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +62 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +104 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +83 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +35 -0
- package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +95 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +709 -0
- package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +59 -0
- package/skills/bpmax-dataset-template-editor/SKILL.md +779 -0
- package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +18 -0
- package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +73 -0
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +186 -0
- package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +106 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +28 -0
- package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +47 -0
- package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +23 -0
- package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +97 -0
- package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +65 -0
- package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +650 -0
- package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +155 -0
- package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +42 -0
- package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +43 -0
- package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +27 -0
- package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +115 -0
- package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +52 -0
- package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +39 -0
- package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +373 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +151 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +4 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +60 -0
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +371 -0
- package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +5 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +97 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +105 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +36 -0
- package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +40 -0
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +33 -0
- package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +17 -0
- package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +40 -0
- package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +19 -0
- package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +75 -0
- package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +107 -0
- package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +29 -0
- package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +54 -0
- package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +58 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +287 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +59 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +687 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +95 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +288 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +161 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +138 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +396 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +341 -0
- package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +185 -0
- package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +138 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +69 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +42 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +38 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +86 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +68 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +39 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +41 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +110 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +278 -0
- package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +203 -0
- package/skills/bpmax-filter-template-editor/SKILL.md +564 -0
- package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +38 -0
- package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +57 -0
- package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +141 -0
- package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +287 -0
- package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +115 -0
- package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +94 -0
- package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +25 -0
- package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +22 -0
- package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +57 -0
- package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +348 -0
- package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +8 -0
- package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +26 -0
- package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +62 -0
- package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +231 -0
- package/skills/bpmax-flow-template-editor/SKILL.md +1043 -0
- package/skills/bpmax-flow-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +62 -0
- package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +270 -0
- package/skills/bpmax-flow-template-editor/references/diff-strategy.md +67 -0
- package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +25 -0
- package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +159 -0
- package/skills/bpmax-flow-template-editor/references/intent-model.md +117 -0
- package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +147 -0
- package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +97 -0
- package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +163 -0
- package/skills/bpmax-flow-template-editor/references/payload-checklist.md +133 -0
- package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +54 -0
- package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +149 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +41 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +155 -0
- package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +179 -0
- package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +91 -0
- package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +93 -0
- package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +57 -0
- package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +69 -0
- package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +52 -0
- package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +114 -0
- package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +1084 -0
- package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +159 -0
- package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +636 -0
- package/skills/bpmax-form-template-editor/SKILL.md +1074 -0
- package/skills/bpmax-form-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +193 -0
- package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +125 -0
- package/skills/bpmax-form-template-editor/references/payload-checklist.md +77 -0
- package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +49 -0
- package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +37 -0
- package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +145 -0
- package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +67 -0
- package/skills/bpmax-form-template-editor/scripts/export_form_template.py +89 -0
- package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +1745 -0
- package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +30 -0
- package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +67 -0
- package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +163 -0
- package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +1303 -0
- package/skills/bpmax-list-template-editor/SKILL.md +468 -0
- package/skills/bpmax-list-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-list-template-editor/references/browser-page-contract.md +81 -0
- package/skills/bpmax-list-template-editor/references/content-config-shape.md +148 -0
- package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +60 -0
- package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +103 -0
- package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +102 -0
- package/skills/bpmax-list-template-editor/references/payload-checklist.md +47 -0
- package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +140 -0
- package/skills/bpmax-list-template-editor/references/special-formats.md +394 -0
- package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +37 -0
- package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +33 -0
- package/skills/bpmax-list-template-editor/scripts/export_list_template.py +89 -0
- package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +34 -0
- package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +54 -0
- package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +955 -0
- package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +55 -0
- package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +117 -0
- package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +441 -0
- package/skills/bpmax-nav-config-editor/SKILL.md +347 -0
- package/skills/bpmax-nav-config-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +68 -0
- package/skills/bpmax-nav-config-editor/references/config-shape.md +78 -0
- package/skills/bpmax-nav-config-editor/references/icon-selection.md +83 -0
- package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +46 -0
- package/skills/bpmax-nav-config-editor/references/payload-checklist.md +41 -0
- package/skills/bpmax-nav-config-editor/references/runtime-probing.md +47 -0
- package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +34 -0
- package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +32 -0
- package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +56 -0
- package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +33 -0
- package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +812 -0
- package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +44 -0
- package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +33 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +358 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +138 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +58 -0
- package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +51 -0
- package/skills/bpmax-project/SKILL.md +1 -1
- package/skills/bpmax-project-detail-template-editor/SKILL.md +329 -0
- package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +4 -0
- package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +59 -0
- package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +47 -0
- package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +33 -0
- package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +44 -0
- package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +30 -0
- package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +33 -0
- package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +87 -0
- package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +37 -0
- package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +507 -0
- package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +120 -0
- package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +369 -0
- package/skills/bpmax-role-editor/SKILL.md +251 -0
- package/skills/bpmax-role-editor/references/api-workflow.md +30 -0
- package/skills/bpmax-role-editor/references/runtime-page-shape.md +18 -0
- package/skills/bpmax-role-editor/references/work-file-mapping.md +32 -0
- package/skills/bpmax-role-editor/scripts/build_submit_payload.py +38 -0
- package/skills/bpmax-role-editor/scripts/confirm_role.py +33 -0
- package/skills/bpmax-role-editor/scripts/export_role.py +163 -0
- package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +38 -0
- package/skills/bpmax-role-editor/scripts/role_editor_common.py +1231 -0
- package/skills/bpmax-role-editor/scripts/submit_role.py +144 -0
- package/skills/bpmax-role-editor/tests/test_role_editor.py +343 -0
- package/skills/bpmax-shared/SKILL.md +1 -1
- package/skills/form-control-library/SKILL.md +82 -0
- package/skills/form-control-library/agents/openai.yaml +4 -0
- package/skills/form-control-library/references/form-controls.md +199 -0
- package/skills/form-control-library/references/form-template-submit-schema.md +180 -0
- package/skills/form-control-library/references/group-select-runtime.md +191 -0
- package/skills/form-control-library/scripts/rebuild_form_control_library.py +55 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
print(
|
|
7
|
+
"Legacy config submit scripts are disabled in bpmax-cli. Use `bpmax-cli config project-detail-template submit` so capability, dry-run, confirmation, audit, and baseline checks are enforced.",
|
|
8
|
+
file=sys.stderr,
|
|
9
|
+
)
|
|
10
|
+
sys.exit(2)
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
|
|
14
|
+
from project_detail_template_editor_common import (
|
|
15
|
+
build_client,
|
|
16
|
+
dump_json,
|
|
17
|
+
ensure_submission_allowed,
|
|
18
|
+
extract_template_id,
|
|
19
|
+
load_json,
|
|
20
|
+
parse_content,
|
|
21
|
+
persist_create_submission_meta,
|
|
22
|
+
paths_for,
|
|
23
|
+
summarize_verification,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
28
|
+
p = argparse.ArgumentParser(description="Submit, activate or delete a BPMAX project-detail-template payload and verify readback.")
|
|
29
|
+
p.add_argument("--stem")
|
|
30
|
+
p.add_argument("--action", choices=("submit", "activate", "delete"), default="submit")
|
|
31
|
+
p.add_argument("--template-id", type=int)
|
|
32
|
+
p.add_argument("--flow-type")
|
|
33
|
+
p.add_argument("--flow-key", default="")
|
|
34
|
+
p.add_argument("--workspace")
|
|
35
|
+
p.add_argument("--base-url")
|
|
36
|
+
p.add_argument("--language", default="zhCN")
|
|
37
|
+
p.add_argument("--cookie-header")
|
|
38
|
+
p.add_argument("--timeout", type=float, default=30)
|
|
39
|
+
p.add_argument("--insecure", action="store_true")
|
|
40
|
+
return p
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def main() -> int:
|
|
44
|
+
args = build_parser().parse_args()
|
|
45
|
+
client = build_client(args)
|
|
46
|
+
|
|
47
|
+
if args.action in ("activate", "delete"):
|
|
48
|
+
if not args.template_id:
|
|
49
|
+
raise SystemExit("--template-id is required for activate/delete")
|
|
50
|
+
if args.action == "activate":
|
|
51
|
+
if not args.flow_type:
|
|
52
|
+
raise SystemExit("--flow-type is required for activate")
|
|
53
|
+
response = client.activate_flow_page_template(args.template_id, flow_type=args.flow_type, flow_key=args.flow_key)
|
|
54
|
+
readback = client.get_flow_page_template(args.template_id).get("data") or {}
|
|
55
|
+
else:
|
|
56
|
+
response = client.delete_flow_page_template(args.template_id)
|
|
57
|
+
readback = {"id": args.template_id, "deleted": True}
|
|
58
|
+
result = {"action": args.action, "templateId": args.template_id, "response": response, "readback": readback}
|
|
59
|
+
if args.stem:
|
|
60
|
+
paths = paths_for(args.stem)
|
|
61
|
+
dump_json(paths["response"], response)
|
|
62
|
+
dump_json(paths["readback"], readback)
|
|
63
|
+
dump_json(paths["verify"], {"ok": True, **result})
|
|
64
|
+
print(paths["response"])
|
|
65
|
+
print(paths["readback"])
|
|
66
|
+
print(paths["verify"])
|
|
67
|
+
else:
|
|
68
|
+
print(result)
|
|
69
|
+
return 0
|
|
70
|
+
|
|
71
|
+
if not args.stem:
|
|
72
|
+
raise SystemExit("--stem is required for action=submit")
|
|
73
|
+
paths = paths_for(args.stem)
|
|
74
|
+
meta = ensure_submission_allowed(paths["meta"], paths["work"], paths["submit"])
|
|
75
|
+
action_mode = meta.get("mode")
|
|
76
|
+
submit_payload = load_json(paths["submit"])
|
|
77
|
+
|
|
78
|
+
if action_mode == "create":
|
|
79
|
+
response = client.create_flow_page_template(submit_payload)
|
|
80
|
+
template_id = extract_template_id(response)
|
|
81
|
+
if not template_id:
|
|
82
|
+
raise SystemExit("create response did not include a template id")
|
|
83
|
+
else:
|
|
84
|
+
template_id = meta.get("templateId")
|
|
85
|
+
if not template_id:
|
|
86
|
+
raise SystemExit("edit submission requires templateId in meta")
|
|
87
|
+
response = client.update_flow_page_template(int(template_id), submit_payload)
|
|
88
|
+
|
|
89
|
+
readback = client.get_flow_page_template(int(template_id)).get("data") or {}
|
|
90
|
+
if action_mode == "create":
|
|
91
|
+
persist_create_submission_meta(
|
|
92
|
+
paths["meta"],
|
|
93
|
+
stem=args.stem,
|
|
94
|
+
action_mode=action_mode,
|
|
95
|
+
template_id=int(template_id),
|
|
96
|
+
readback=readback,
|
|
97
|
+
)
|
|
98
|
+
verification = summarize_verification(submit_payload, readback)
|
|
99
|
+
dump_json(paths["response"], response)
|
|
100
|
+
dump_json(paths["readback"], readback)
|
|
101
|
+
dump_json(
|
|
102
|
+
paths["verify"],
|
|
103
|
+
{
|
|
104
|
+
"ok": verification["ok"],
|
|
105
|
+
"mode": action_mode,
|
|
106
|
+
"templateId": template_id,
|
|
107
|
+
"submittedContent": parse_content(submit_payload.get("content")),
|
|
108
|
+
"verification": verification,
|
|
109
|
+
},
|
|
110
|
+
)
|
|
111
|
+
print(paths["response"])
|
|
112
|
+
print(paths["readback"])
|
|
113
|
+
print(paths["verify"])
|
|
114
|
+
if not verification["ok"]:
|
|
115
|
+
raise SystemExit("readback verification failed; inspect verify.json for mismatches")
|
|
116
|
+
return 0
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
if __name__ == "__main__":
|
|
120
|
+
raise SystemExit(main())
|
package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import tempfile
|
|
5
|
+
import unittest
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from unittest import mock
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
|
|
11
|
+
if str(SCRIPT_DIR) not in sys.path:
|
|
12
|
+
sys.path.insert(0, str(SCRIPT_DIR))
|
|
13
|
+
|
|
14
|
+
import project_detail_template_editor_common as common # noqa: E402
|
|
15
|
+
import submit_project_detail_template as submit_script # noqa: E402
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ProjectDetailTemplateEditorTests(unittest.TestCase):
|
|
19
|
+
def _write_ready_submit_fixture(self, root: Path, *, stem: str, mode: str, template_id: int | None = None) -> dict[str, Path]:
|
|
20
|
+
paths = {
|
|
21
|
+
"meta": root / "meta.json",
|
|
22
|
+
"work": root / "work.json",
|
|
23
|
+
"submit": root / "submit.json",
|
|
24
|
+
}
|
|
25
|
+
work_payload = {
|
|
26
|
+
"id": template_id if mode == "edit" else None,
|
|
27
|
+
"mode": mode,
|
|
28
|
+
"basic": {
|
|
29
|
+
"name": "详情模板",
|
|
30
|
+
"desc": "",
|
|
31
|
+
"type": 2,
|
|
32
|
+
"flow_type": "flow801021391",
|
|
33
|
+
"flow_key": "",
|
|
34
|
+
"status": 1,
|
|
35
|
+
},
|
|
36
|
+
"content": {"config": {}, "main_col": [], "side_col": []},
|
|
37
|
+
"meta": {},
|
|
38
|
+
}
|
|
39
|
+
common.dump_json(paths["work"], work_payload)
|
|
40
|
+
common.dump_json(
|
|
41
|
+
paths["meta"],
|
|
42
|
+
common.ensure_meta_shape(
|
|
43
|
+
{"stem": stem, "mode": mode, "workspace": "store_mgr", "templateId": template_id},
|
|
44
|
+
stem,
|
|
45
|
+
),
|
|
46
|
+
)
|
|
47
|
+
common.dump_json(paths["submit"], common.build_submit_payload(work_payload))
|
|
48
|
+
common.update_confirmation_state(
|
|
49
|
+
paths["meta"], stem=stem, actor="codex", stage="submit", work_path=paths["work"], submit_path=paths["submit"]
|
|
50
|
+
)
|
|
51
|
+
lint_path = root / "lint.json"
|
|
52
|
+
common.dump_json(lint_path, {"ok": True})
|
|
53
|
+
common.update_lint_meta(paths["meta"], stem=stem, submit_path=paths["submit"], lint_path=lint_path, report={"ok": True})
|
|
54
|
+
meta_payload = common.load_json(paths["meta"])
|
|
55
|
+
meta_payload["status"] = "submit_confirmed"
|
|
56
|
+
common.dump_json(paths["meta"], meta_payload)
|
|
57
|
+
return paths
|
|
58
|
+
|
|
59
|
+
def test_edit_round_trip_builds_submit(self) -> None:
|
|
60
|
+
detail = {
|
|
61
|
+
"id": 954573597,
|
|
62
|
+
"name": "入库信息",
|
|
63
|
+
"desc": "用于项目详情页面展示加盟商信息",
|
|
64
|
+
"type": 2,
|
|
65
|
+
"status": 1,
|
|
66
|
+
"flow_type": "flow801021391",
|
|
67
|
+
"flow_key": "",
|
|
68
|
+
"content": "{\"config\":{\"enable_share\":true},\"main_col\":[{\"type\":\"meta-form\",\"title\":\"待入库信息\",\"config\":{}}],\"side_col\":[{\"type\":\"step-log\",\"title\":\"流程日志\",\"config\":{}}]}",
|
|
69
|
+
"uuid": "1008e2bf-6675-459b-ac79-f7768b224b76",
|
|
70
|
+
}
|
|
71
|
+
work = common.detail_to_work_payload(detail, mode="edit")
|
|
72
|
+
submit = common.build_submit_payload(work)
|
|
73
|
+
self.assertEqual(submit["type"], 2)
|
|
74
|
+
self.assertEqual(common.parse_content(submit["content"])["main_col"][0]["type"], "meta-form")
|
|
75
|
+
|
|
76
|
+
def test_create_skeleton_stem_and_payload(self) -> None:
|
|
77
|
+
detail = {
|
|
78
|
+
"id": 954573597,
|
|
79
|
+
"name": "入库信息",
|
|
80
|
+
"desc": "",
|
|
81
|
+
"flow_type": "flow801021391",
|
|
82
|
+
"flow_key": "",
|
|
83
|
+
"type": 2,
|
|
84
|
+
"status": 1,
|
|
85
|
+
"content": "{\"config\":{},\"main_col\":[],\"side_col\":[]}",
|
|
86
|
+
}
|
|
87
|
+
stem = common.create_stem("flow801021391", "", 954573597)
|
|
88
|
+
raw = common.build_create_raw_payload(detail, sample_template_id=954573597)
|
|
89
|
+
self.assertEqual(stem, "create-flow801021391-default-954573597")
|
|
90
|
+
self.assertEqual(raw["sampleTemplateId"], 954573597)
|
|
91
|
+
self.assertEqual(raw["type"], 2)
|
|
92
|
+
|
|
93
|
+
def test_lint_blocks_side_only_module_in_main_col(self) -> None:
|
|
94
|
+
work = {
|
|
95
|
+
"mode": "edit",
|
|
96
|
+
"basic": {
|
|
97
|
+
"name": "详情模板",
|
|
98
|
+
"desc": "",
|
|
99
|
+
"type": 2,
|
|
100
|
+
"flow_type": "flow801021391",
|
|
101
|
+
"flow_key": "",
|
|
102
|
+
"status": 1,
|
|
103
|
+
},
|
|
104
|
+
"content": {
|
|
105
|
+
"config": {},
|
|
106
|
+
"main_col": [{"type": "step-log", "title": "流程日志", "config": {}}],
|
|
107
|
+
"side_col": [],
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
report = common.lint_project_detail_template_semantics(work)
|
|
111
|
+
self.assertFalse(report["ok"])
|
|
112
|
+
self.assertTrue(any("not allowed in main_col" in item for item in report["errors"]))
|
|
113
|
+
|
|
114
|
+
def test_lint_blocks_missing_main_or_side_shape(self) -> None:
|
|
115
|
+
work = {
|
|
116
|
+
"mode": "edit",
|
|
117
|
+
"basic": {
|
|
118
|
+
"name": "详情模板",
|
|
119
|
+
"desc": "",
|
|
120
|
+
"type": 2,
|
|
121
|
+
"flow_type": "flow801021391",
|
|
122
|
+
"flow_key": "",
|
|
123
|
+
"status": 1,
|
|
124
|
+
},
|
|
125
|
+
"content": {"config": [], "main_col": {}, "side_col": []},
|
|
126
|
+
}
|
|
127
|
+
with self.assertRaises(SystemExit):
|
|
128
|
+
common.build_submit_payload(work)
|
|
129
|
+
|
|
130
|
+
def test_unknown_module_is_advanced_mode_warning_not_blocker(self) -> None:
|
|
131
|
+
work = {
|
|
132
|
+
"mode": "edit",
|
|
133
|
+
"basic": {
|
|
134
|
+
"name": "详情模板",
|
|
135
|
+
"desc": "",
|
|
136
|
+
"type": 2,
|
|
137
|
+
"flow_type": "flow801021391",
|
|
138
|
+
"flow_key": "",
|
|
139
|
+
"status": 1,
|
|
140
|
+
},
|
|
141
|
+
"content": {
|
|
142
|
+
"config": {},
|
|
143
|
+
"main_col": [{"type": "not-exist-yet", "title": "实验模块", "config": {}}],
|
|
144
|
+
"side_col": [],
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
report = common.lint_project_detail_template_semantics(work)
|
|
148
|
+
self.assertTrue(report["ok"])
|
|
149
|
+
self.assertTrue(any("advanced JSON mode candidate only" in item for item in report["warnings"]))
|
|
150
|
+
|
|
151
|
+
def test_lint_blocks_project_list_query(self) -> None:
|
|
152
|
+
work = {
|
|
153
|
+
"mode": "edit",
|
|
154
|
+
"basic": {
|
|
155
|
+
"name": "详情模板",
|
|
156
|
+
"desc": "",
|
|
157
|
+
"type": 2,
|
|
158
|
+
"flow_type": "flow801021391",
|
|
159
|
+
"flow_key": "",
|
|
160
|
+
"status": 1,
|
|
161
|
+
},
|
|
162
|
+
"content": {
|
|
163
|
+
"config": {
|
|
164
|
+
"$template": (
|
|
165
|
+
"{ return ctx.$axios.post('/bpmax/project/list?page=1', "
|
|
166
|
+
"{ flow_type: 'flow801021391', query: {} }); }"
|
|
167
|
+
)
|
|
168
|
+
},
|
|
169
|
+
"main_col": [],
|
|
170
|
+
"side_col": [],
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
report = common.lint_project_detail_template_semantics(work)
|
|
174
|
+
self.assertFalse(report["ok"])
|
|
175
|
+
self.assertTrue(any("project/list" in item for item in report["errors"]))
|
|
176
|
+
|
|
177
|
+
def test_submit_gate_requires_lint(self) -> None:
|
|
178
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
179
|
+
meta = Path(tmpdir) / "meta.json"
|
|
180
|
+
work = Path(tmpdir) / "work.json"
|
|
181
|
+
submit = Path(tmpdir) / "submit.json"
|
|
182
|
+
common.dump_json(
|
|
183
|
+
work,
|
|
184
|
+
{
|
|
185
|
+
"mode": "edit",
|
|
186
|
+
"basic": {
|
|
187
|
+
"name": "详情模板",
|
|
188
|
+
"desc": "",
|
|
189
|
+
"type": 2,
|
|
190
|
+
"flow_type": "flow801021391",
|
|
191
|
+
"flow_key": "",
|
|
192
|
+
"status": 1,
|
|
193
|
+
},
|
|
194
|
+
"content": {"config": {}, "main_col": [], "side_col": []},
|
|
195
|
+
},
|
|
196
|
+
)
|
|
197
|
+
common.dump_json(meta, common.ensure_meta_shape({"stem": "x", "mode": "edit", "workspace": "store_mgr"}, "x"))
|
|
198
|
+
common.update_confirmation_state(meta, stem="x", actor="codex", stage="work", work_path=work, submit_path=submit)
|
|
199
|
+
common.dump_json(submit, common.build_submit_payload(common.load_json(work)))
|
|
200
|
+
common.update_build_meta(meta, stem="x", work_path=work, submit_path=submit)
|
|
201
|
+
common.update_confirmation_state(meta, stem="x", actor="codex", stage="submit", work_path=work, submit_path=submit)
|
|
202
|
+
with self.assertRaises(SystemExit):
|
|
203
|
+
common.ensure_submission_allowed(meta, work, submit)
|
|
204
|
+
|
|
205
|
+
def test_persist_create_submission_meta_sets_edit_mode_and_ids(self) -> None:
|
|
206
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
207
|
+
meta_path = Path(tmpdir) / "meta.json"
|
|
208
|
+
common.dump_json(
|
|
209
|
+
meta_path,
|
|
210
|
+
common.ensure_meta_shape(
|
|
211
|
+
{"stem": "x", "mode": "create", "workspace": "store_mgr", "status": "submit_confirmed"},
|
|
212
|
+
"x",
|
|
213
|
+
),
|
|
214
|
+
)
|
|
215
|
+
payload = common.persist_create_submission_meta(
|
|
216
|
+
meta_path,
|
|
217
|
+
stem="x",
|
|
218
|
+
action_mode="create",
|
|
219
|
+
template_id=123,
|
|
220
|
+
readback={"id": 123, "uuid": "uuid-123"},
|
|
221
|
+
)
|
|
222
|
+
self.assertEqual(payload["mode"], "edit")
|
|
223
|
+
self.assertEqual(payload["templateId"], 123)
|
|
224
|
+
self.assertEqual(payload["templateUuid"], "uuid-123")
|
|
225
|
+
self.assertEqual(payload["status"], "submit_confirmed")
|
|
226
|
+
|
|
227
|
+
def test_submit_create_persists_meta_and_verify_mode(self) -> None:
|
|
228
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
229
|
+
tmp_root = Path(tmpdir)
|
|
230
|
+
stem = "create-stem"
|
|
231
|
+
paths = self._write_ready_submit_fixture(tmp_root, stem=stem, mode="create")
|
|
232
|
+
script_paths = {
|
|
233
|
+
"meta": paths["meta"],
|
|
234
|
+
"work": paths["work"],
|
|
235
|
+
"submit": paths["submit"],
|
|
236
|
+
"response": tmp_root / "response.json",
|
|
237
|
+
"readback": tmp_root / "readback.json",
|
|
238
|
+
"verify": tmp_root / "verify.json",
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
class FakeClient:
|
|
242
|
+
def __init__(self) -> None:
|
|
243
|
+
self.created_payloads: list[dict] = []
|
|
244
|
+
self.updated_payloads: list[tuple[int, dict]] = []
|
|
245
|
+
|
|
246
|
+
def create_flow_page_template(self, payload: dict) -> dict:
|
|
247
|
+
self.created_payloads.append(payload)
|
|
248
|
+
return {"data": {"id": 321}}
|
|
249
|
+
|
|
250
|
+
def update_flow_page_template(self, template_id: int, payload: dict) -> dict:
|
|
251
|
+
self.updated_payloads.append((template_id, payload))
|
|
252
|
+
return {"data": {"id": template_id}}
|
|
253
|
+
|
|
254
|
+
def get_flow_page_template(self, template_id: int) -> dict:
|
|
255
|
+
return {
|
|
256
|
+
"data": {
|
|
257
|
+
"id": template_id,
|
|
258
|
+
"uuid": "uuid-321",
|
|
259
|
+
"name": "详情模板",
|
|
260
|
+
"desc": "",
|
|
261
|
+
"type": 2,
|
|
262
|
+
"flow_type": "flow801021391",
|
|
263
|
+
"flow_key": "",
|
|
264
|
+
"content": "{\"config\":{},\"main_col\":[],\"side_col\":[]}",
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
client = FakeClient()
|
|
269
|
+
with mock.patch.object(submit_script, "build_client", return_value=client), mock.patch.object(
|
|
270
|
+
submit_script, "paths_for", return_value=script_paths
|
|
271
|
+
), mock.patch.object(sys, "argv", ["submit_project_detail_template.py", "--stem", stem, "--workspace", "store_mgr"]):
|
|
272
|
+
self.assertEqual(submit_script.main(), 0)
|
|
273
|
+
|
|
274
|
+
meta_payload = common.load_json(paths["meta"])
|
|
275
|
+
verify_payload = common.load_json(script_paths["verify"])
|
|
276
|
+
self.assertEqual(len(client.created_payloads), 1)
|
|
277
|
+
self.assertEqual(client.updated_payloads, [])
|
|
278
|
+
self.assertEqual(meta_payload["mode"], "edit")
|
|
279
|
+
self.assertEqual(meta_payload["templateId"], 321)
|
|
280
|
+
self.assertEqual(meta_payload["templateUuid"], "uuid-321")
|
|
281
|
+
self.assertEqual(meta_payload["status"], "submit_confirmed")
|
|
282
|
+
self.assertEqual(verify_payload["mode"], "create")
|
|
283
|
+
|
|
284
|
+
def test_second_submit_uses_update_when_meta_has_template_id(self) -> None:
|
|
285
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
286
|
+
tmp_root = Path(tmpdir)
|
|
287
|
+
stem = "edit-stem"
|
|
288
|
+
paths = self._write_ready_submit_fixture(tmp_root, stem=stem, mode="edit", template_id=654)
|
|
289
|
+
script_paths = {
|
|
290
|
+
"meta": paths["meta"],
|
|
291
|
+
"work": paths["work"],
|
|
292
|
+
"submit": paths["submit"],
|
|
293
|
+
"response": tmp_root / "response.json",
|
|
294
|
+
"readback": tmp_root / "readback.json",
|
|
295
|
+
"verify": tmp_root / "verify.json",
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
class FakeClient:
|
|
299
|
+
def __init__(self) -> None:
|
|
300
|
+
self.created = 0
|
|
301
|
+
self.updated_payloads: list[tuple[int, dict]] = []
|
|
302
|
+
|
|
303
|
+
def create_flow_page_template(self, payload: dict) -> dict:
|
|
304
|
+
self.created += 1
|
|
305
|
+
return {"data": {"id": 1}}
|
|
306
|
+
|
|
307
|
+
def update_flow_page_template(self, template_id: int, payload: dict) -> dict:
|
|
308
|
+
self.updated_payloads.append((template_id, payload))
|
|
309
|
+
return {"data": {"id": template_id}}
|
|
310
|
+
|
|
311
|
+
def get_flow_page_template(self, template_id: int) -> dict:
|
|
312
|
+
return {
|
|
313
|
+
"data": {
|
|
314
|
+
"id": template_id,
|
|
315
|
+
"name": "详情模板",
|
|
316
|
+
"desc": "",
|
|
317
|
+
"type": 2,
|
|
318
|
+
"flow_type": "flow801021391",
|
|
319
|
+
"flow_key": "",
|
|
320
|
+
"content": "{\"config\":{},\"main_col\":[],\"side_col\":[]}",
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
client = FakeClient()
|
|
325
|
+
with mock.patch.object(submit_script, "build_client", return_value=client), mock.patch.object(
|
|
326
|
+
submit_script, "paths_for", return_value=script_paths
|
|
327
|
+
), mock.patch.object(sys, "argv", ["submit_project_detail_template.py", "--stem", stem, "--workspace", "store_mgr"]):
|
|
328
|
+
self.assertEqual(submit_script.main(), 0)
|
|
329
|
+
|
|
330
|
+
self.assertEqual(client.created, 0)
|
|
331
|
+
self.assertEqual(len(client.updated_payloads), 1)
|
|
332
|
+
self.assertEqual(client.updated_payloads[0][0], 654)
|
|
333
|
+
self.assertEqual(common.load_json(script_paths["verify"])["mode"], "edit")
|
|
334
|
+
self.assertEqual(common.load_json(paths["meta"])["mode"], "edit")
|
|
335
|
+
|
|
336
|
+
def test_submit_create_without_id_does_not_corrupt_meta(self) -> None:
|
|
337
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
338
|
+
tmp_root = Path(tmpdir)
|
|
339
|
+
stem = "create-no-id"
|
|
340
|
+
paths = self._write_ready_submit_fixture(tmp_root, stem=stem, mode="create")
|
|
341
|
+
script_paths = {
|
|
342
|
+
"meta": paths["meta"],
|
|
343
|
+
"work": paths["work"],
|
|
344
|
+
"submit": paths["submit"],
|
|
345
|
+
"response": tmp_root / "response.json",
|
|
346
|
+
"readback": tmp_root / "readback.json",
|
|
347
|
+
"verify": tmp_root / "verify.json",
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
class FakeClient:
|
|
351
|
+
def create_flow_page_template(self, payload: dict) -> dict:
|
|
352
|
+
return {"data": {}}
|
|
353
|
+
|
|
354
|
+
before_meta = common.load_json(paths["meta"])
|
|
355
|
+
with mock.patch.object(submit_script, "build_client", return_value=FakeClient()), mock.patch.object(
|
|
356
|
+
submit_script, "paths_for", return_value=script_paths
|
|
357
|
+
), mock.patch.object(sys, "argv", ["submit_project_detail_template.py", "--stem", stem, "--workspace", "store_mgr"]):
|
|
358
|
+
with self.assertRaises(SystemExit) as ctx:
|
|
359
|
+
submit_script.main()
|
|
360
|
+
|
|
361
|
+
after_meta = common.load_json(paths["meta"])
|
|
362
|
+
self.assertIn("create response did not include a template id", str(ctx.exception))
|
|
363
|
+
self.assertEqual(before_meta["mode"], "create")
|
|
364
|
+
self.assertEqual(after_meta["mode"], "create")
|
|
365
|
+
self.assertIsNone(after_meta["templateId"])
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
if __name__ == "__main__":
|
|
369
|
+
unittest.main()
|