Files
ssw-mvp/docs/e2e/cases/TC-IDENTITY_API-002.mjs
admin 3247e9fd15 init: ssw-mvp initial commit
- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
2026-08-05 18:29:12 +08:00

45 lines
1.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* TC-IDENTITY_API-002 · 条件不满足时不能办理身份注册(接口级)
* REQ-047 [FL-1.2] 反向/等价类 P0
*
* 前置:通过已认证的调用方连接器调用"身份注册"接口可以正常打开 / 已准备无权限账号或错误数据
* 步骤:调用"身份注册"接口 → 使用无权限账号或错误数据办理身份注册 → 提交,查看提示与数据
* 预期:系统不允许办理身份注册,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-IDENTITY_API-002',
req: 'REQ-047',
title: '条件不满足时不能办理身份注册',
type: '反向/等价类',
priority: 'P0',
route: '',
needs: ['be']
}
export async function run(t) {
let beforeTotal = 0
await t.step('前置:以 admin token 接入', async () => {
await t.login()
const r = await t.api('GET', '/api/permission/Users?currentPage=1&pageSize=1')
beforeTotal = r?.pagination?.total ?? r?.data?.pagination?.total ?? 0
t.assert(true, `当前用户 ${beforeTotal} 作为基线`)
})
await t.step('反向 1:缺 token 调用 /api/permission/Users', async () => {
const r = await t.api('POST', '/api/permission/Users', { account: 'should_not_apply_token' }, { token: 'bearer invalid.token.fake' })
t.assert(r && String(r.code) !== '200', `缺/错 token 被拒(code=${r?.code})`)
})
await t.step('反向 2:空体调用 /api/permission/Users', async () => {
const r = await t.api('POST', '/api/permission/Users', {})
t.assert(r && String(r.code) !== '200', `空体被拒(code=${r?.code} msg=${r?.msg})`)
})
await t.step('核对:总数未脏增', async () => {
const r = await t.api('GET', '/api/permission/Users?currentPage=1&pageSize=1')
const after = r?.pagination?.total ?? r?.data?.pagination?.total ?? 0
t.assert(Number(after) === Number(beforeTotal), `用户总数未变(${beforeTotal} → ${after})`)
})
}