feat: 腾讯 AppID 自动补全 tencent 前缀
新增/编辑 App 时,腾讯 AppID 允许只填数字,后端统一归一化为 tencent 前缀;前端输入框失焦即时补全,保存前再校正一次。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,31 @@ def test_create_app_rejects_unknown_environment_id_rule(client, tmp_config):
|
||||
assert "ID 规则" in resp.json()["detail"]
|
||||
|
||||
|
||||
def test_create_app_prefixes_tencent_app_id(client, tmp_config):
|
||||
resp = client.post("/api/config/apps", json={
|
||||
"name": "腾讯App", "server": "测试环境", "AppGuid": "guid", "tencent": "123456",
|
||||
})
|
||||
assert resp.status_code == 200
|
||||
app_id = resp.json()["id"]
|
||||
assert client.get("/api/config/apps").json()[app_id]["tencent"] == "tencent123456"
|
||||
|
||||
|
||||
def test_create_app_keeps_existing_tencent_prefix(client, tmp_config):
|
||||
resp = client.post("/api/config/apps", json={
|
||||
"name": "腾讯App2", "server": "测试环境", "AppGuid": "guid", "tencent": "tencent123456",
|
||||
})
|
||||
app_id = resp.json()["id"]
|
||||
assert client.get("/api/config/apps").json()[app_id]["tencent"] == "tencent123456"
|
||||
|
||||
|
||||
def test_update_app_prefixes_tencent_app_id(client, tmp_config):
|
||||
resp = client.put("/api/config/apps/1", json={
|
||||
"name": "改名App", "AppGuid": "test-guid", "tencent": " 987654 ",
|
||||
})
|
||||
assert resp.status_code == 200
|
||||
assert client.get("/api/config/apps").json()["1"]["tencent"] == "tencent987654"
|
||||
|
||||
|
||||
def test_update_app(client, tmp_config):
|
||||
resp = client.put("/api/config/apps/1", json={"name": "改名App", "AppGuid": "test-guid"})
|
||||
assert resp.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user