Files
ssw-mvp/docs/e2e/cases/TC-IDENTITY_API-008.mjs
T
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

48 lines
2.3 KiB
JavaScript
Raw 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-008 · 条件不满足时不能办理身份更新(接口级)
* REQ-049 [FL-1.3] 反向/等价类 P0
*
* 前置:通过已认证的调用方连接器调用"身份更新"接口可以正常打开 / 已准备无权限账号或错误数据
* 步骤:调用"身份更新"接口 → 使用无权限账号或错误数据办理身份更新 → 提交,查看提示与数据
* 预期:系统不允许办理身份更新,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-IDENTITY_API-008',
req: 'REQ-049',
title: '条件不满足时不能办理身份更新',
type: '反向/等价类',
priority: 'P0',
route: '',
needs: ['be']
}
export async function run(t) {
let beforeMember = null
await t.step('前置:登录、记录一条 NORMAL 会员基线', async () => {
await t.login()
const list = await t.apiList('/api/ssw/tdc/Member', { pageSize: 20 })
const target = list.find((m) => m.status !== 'CANCELLED')
if (!target) t.skip('库内找不到 NORMAL 状态 Member')
beforeMember = { ...target }
t.assert(true, `基线 id=${target.id} email=${target.email}`)
})
await t.step('反向 1:对不存在 id 调用 UpdateProfile 应被业务拒绝', async () => {
const r = await t.api('PUT', '/api/ssw/tdc/Member/NON_EXIST_E2E_ID/UpdateProfile', { email: '[email protected]' })
t.assert(r && String(r.code) !== '200', `不存在 id 被拒(code=${r?.code} msg=${r?.msg})`)
})
await t.step('反向 2:用伪造 token 调用 UpdateProfile 应被 sa-token 拦截', async () => {
const r = await t.api('PUT', `/api/ssw/tdc/Member/${beforeMember.id}/UpdateProfile`, { email: '[email protected]' }, { token: 'bearer invalid.token.fake' })
t.assert(r && String(r.code) !== '200', `伪造 token 被拒(code=${r?.code})`)
})
await t.step('核对:原会员数据未被脏改', async () => {
const after = await t.api('GET', `/api/ssw/tdc/Member/${beforeMember.id}`)
t.assert(after.email === beforeMember.email, `邮箱未被脏改(${beforeMember.email})`)
t.assert(after.email !== '[email protected]', '非法请求未污染数据')
t.assert(after.email !== '[email protected]', '伪造请求未污染数据')
})
}