Files
RuoYi-Vue3-FastAPI/ruoyi-fastapi-backend/tests/cli/root/test_plugin_create_templates.py
T
insistence 4bd83bc7cd feat: 支持 v2 插件、独立前端和签名制品发布 (#130)
* feat: 支持 v2 插件、原生扩展与签名发布

* fix: 修复测试

* feat: 增强宿主 SDK、运行观测与制品维护能力

* feat: 增强文件传输、配置观测与本地开发能力

* feat: 支持 SSE 实时事件流并完善开发脚手架

* feat: 完善长连接鉴权复核与关闭回收

* feat: 增强生命周期与任务关闭可靠性

* feat: 收紧健康检查契约并补齐前端与真实网络验收

* feat: 增加SDK溯源与离线更新工具并验证跨版本兼容

* feat: 增加持久化业务示例与受控 Python 交付

* feat: 增加统一运行诊断与多worker状态观测

* feat: 增加固定目标发布等待与自动验收

* fix: 修复多环境插件部署前缀与代理配置不一致

* fix: 修复测试
2026-10-09 23:49:45 +08:00

50 lines
1.7 KiB
Python

from typing import Any
import pytest
import typer
from typer.testing import CliRunner
from cli.groups.plugin.commands.developer import register_developer_commands
from cli.groups.plugin.options import PluginCreateCommandOptions
@pytest.mark.parametrize('template', ['python-asgi', 'python-bundle', 'rust-asgi', 'rust-bundle'])
def test_create_cli_forwards_v2_template_without_changing_default_options(template: str) -> None:
"""
验证 v2 模板参数传递且不改变既有默认选项。
"""
recorded: list[tuple[Any, ...]] = []
class Controller:
@staticmethod
def create_plugin(*args: Any) -> None:
recorded.append(args)
app = typer.Typer()
register_developer_commands(app, Controller)
result = CliRunner().invoke(
app, ['create', 'invoice_ops_27', '--template', template, '--dry-run', '--output', 'json']
)
assert result.exit_code == 0, result.output
plugin_id, env, output, options = recorded[0]
assert (plugin_id, env, output) == ('invoice_ops_27', 'dev', 'json')
assert options == PluginCreateCommandOptions(template=template, dry_run=True)
def test_create_cli_defaults_to_existing_v1_full_stack_template() -> None:
"""
验证未指定模板时继续生成原有 v1 完整模板。
"""
recorded: list[PluginCreateCommandOptions] = []
class Controller:
@staticmethod
def create_plugin(plugin_id: str, env: str, output: str, options: PluginCreateCommandOptions) -> None:
recorded.append(options)
app = typer.Typer()
register_developer_commands(app, Controller)
result = CliRunner().invoke(app, ['create', 'legacy_demo'])
assert result.exit_code == 0
assert recorded == [PluginCreateCommandOptions()]