- 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
86 lines
3.7 KiB
JavaScript
86 lines
3.7 KiB
JavaScript
/**
|
||
* TC-CONTRACT_API-001 · 正常办理合约签订
|
||
* REQ-056 [FL-5.2] 正向/场景法 P0
|
||
*
|
||
* 前置:1. 已获数据提供方角色的机构用户
|
||
* 2. 通过已认证的调用方连接器调用"合约签订"接口可以正常打开
|
||
* 3. 已准备好测试数据
|
||
* 步骤:1. 打开通过已认证的调用方连接器调用"合约签订"接口
|
||
* 2. 按页面提示填写或选择正确的数据
|
||
* 3. 点击提交,查看办理结果
|
||
* 预期:合约签订办理成功,系统按要求完成处理,状态和记录正确。
|
||
*/
|
||
export const meta = {
|
||
tc: 'TC-CONTRACT_API-001',
|
||
req: 'REQ-056',
|
||
title: '正常办理合约签订',
|
||
type: '正向/场景法',
|
||
priority: 'P0',
|
||
route: '',
|
||
needs: ['be']
|
||
}
|
||
|
||
export async function run(t) {
|
||
let created = null
|
||
|
||
await t.step('前置:登录拿 token,并取一个空间下的两个连接器与一个产品', async () => {
|
||
await t.login()
|
||
const conns = await t.apiList('/api/ssw/tds/Connector', { pageSize: 50 })
|
||
const prods = await t.apiList('/api/ssw/tds/DataProduct', { pageSize: 50 })
|
||
const inSpace = (c) => prods.some((p) => p.spaceId === c.spaceId)
|
||
const usable = conns.filter(inSpace)
|
||
if (usable.length < 2) t.skip('同一空间下连接器不足 2 个,无法签约')
|
||
created = {
|
||
providerId: usable[0].id,
|
||
consumerId: usable[1].id,
|
||
spaceId: usable[0].spaceId,
|
||
productId: prods.find((p) => p.spaceId === usable[0].spaceId).id
|
||
}
|
||
t.assert(true, `已选提供方连接器 ${created.providerId} / 使用方 ${created.consumerId} / 产品 ${created.productId}`)
|
||
})
|
||
|
||
await t.step('调用合约签订接口(POST /api/ssw/tds/Contract)提交合约', async () => {
|
||
const code = t.uid('CT')
|
||
const name = `测试合约-${t.runId}`
|
||
const res = await t.api('POST', '/api/ssw/tds/Contract', {
|
||
contractCode: code,
|
||
name,
|
||
spaceId: created.spaceId,
|
||
productId: created.productId,
|
||
providerConnectorId: created.providerId,
|
||
consumerConnectorId: created.consumerId,
|
||
purpose: '联合建模',
|
||
deliveryType: 'PRIVACY_COMPUTE',
|
||
policyContent: '{"policies":["ACTION_ACCESS","ACTION_VIEW"]}',
|
||
termsContent: '测试条款 - ' + t.runId,
|
||
priceMode: 'BY_CALL',
|
||
amount: 100,
|
||
quotaTotal: 1000
|
||
})
|
||
t.assert(res.code === 200, `合约签订成功(msg=${res.msg})`)
|
||
t.assert(typeof res.data === 'string' && res.data.length > 0, `返回合约 id=${res.data}`)
|
||
created.id = res.data
|
||
created.code = code
|
||
created.name = name
|
||
})
|
||
|
||
await t.step('核对落库记录:状态=01、内容哈希、版本与配额均符合国标', async () => {
|
||
const r = await t.api('GET', `/api/ssw/tds/Contract/${created.id}`)
|
||
const c = r.data
|
||
t.assert(r.code === 200, '详情接口返回成功')
|
||
t.assert(c.contractCode === created.code, `合约标识一致(${c.contractCode})`)
|
||
t.assert(c.name === created.name, `合约名称一致(${c.name})`)
|
||
t.assert(c.status === '01', `初始状态为待签署 01(实际 ${c.status})`)
|
||
t.assert(!!c.contentHash && c.contentHash.length === 64, `内容哈希已按 SHA-256 落库(${c.contentHash})`)
|
||
t.assert(c.version === 1, `初始版本号为 1(实际 ${c.version})`)
|
||
t.assert(c.quotaUsed === 0, `已用配额为 0`)
|
||
t.assert(c.providerConnectorId === created.providerId, '提供方连接器已绑定')
|
||
t.assert(c.consumerConnectorId === created.consumerId, '使用方连接器已绑定')
|
||
})
|
||
|
||
await t.step('列表接口能搜到这条合约', async () => {
|
||
const list = await t.apiList('/api/ssw/tds/Contract', { keyword: created.code })
|
||
const hit = list.find((x) => x.id === created.id)
|
||
t.assert(!!hit, `关键字 ${created.code} 能在列表里命中`)
|
||
})
|
||
} |