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

47 lines
2.2 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-010 · 条件不满足时不能办理身份信息查询(接口级)
* REQ-050 [FL-1.3] 反向/等价类 P0
*
* 前置:通过已认证的调用方连接器调用"身份信息查询"接口可以正常打开 / 已准备无权限账号或错误数据
* 步骤:调用"身份信息查询"接口 → 使用无权限账号或错误数据办理身份信息查询 → 提交,查看提示与数据
* 预期:系统不允许办理身份信息查询,并说明原因。原有数据和状态不变。
*/
export const meta = {
tc: 'TC-IDENTITY_API-010',
req: 'REQ-050',
title: '条件不满足时不能办理身份信息查询',
type: '反向/等价类',
priority: 'P0',
route: '',
needs: ['be']
}
export async function run(t) {
await t.step('前置:登录', async () => {
await t.login()
t.assert(!!t.token, 'admin token 已注入')
})
await t.step('反向 1:不存在的 platform userId,查询接口应被业务拒绝', async () => {
const r = await t.api('GET', '/api/permission/Users/NON_EXIST_E2E_USER_ID')
t.assert(r && String(r.code) !== '200', `不存在用户被拒(code=${r?.code} msg=${r?.msg})`)
})
await t.step('反向 2:不存在的 Member id,查询接口应被业务拒绝', async () => {
const r = await t.api('GET', '/api/ssw/tdc/Member/NON_EXIST_E2E_MEMBER_ID')
t.assert(r && String(r.code) !== '200', `不存在会员被拒(code=${r?.code} msg=${r?.msg})`)
})
await t.step('反向 3:伪造 token 调用查询接口,应被 sa-token 拦截', async () => {
const r = await t.api('GET', '/api/permission/Users/whatever', undefined, { token: 'bearer invalid.token.fake' })
t.assert(r && String(r.code) !== '200', `伪造 token 被拒(code=${r?.code})`)
})
await t.step('核对:合法查询仍可工作', async () => {
// 用一个能拿到 admin 详情的正向,验证整个 token 与 session 没被前面的错误请求污染
const me = await t.api('GET', '/api/oauth/CurrentUser')
const ok = await t.api('GET', `/api/permission/Users/${me.data.userInfo.userId}`)
t.assert(ok && ok.id === me.data.userInfo.userId, `合法查询 admin 详情仍可成功(id=${ok?.id})`)
})
}