Compact contour actions and delete VPS applications with all access
Device Core qualification / qualify (push) Successful in 7m19s
Device Core qualification / qualify (push) Successful in 7m19s
This commit is contained in:
@@ -303,3 +303,18 @@ test('VPS onboarding reuses the project host and audits no credential material',
|
||||
assert.ok(audit.length > 0);
|
||||
assert.ok(!JSON.stringify(audit).includes(pkg.client_secret));
|
||||
});
|
||||
|
||||
|
||||
test('application deletion requires company and credential authority and forwards only the application ID', async () => {
|
||||
const repo = repository(); const calls = [];
|
||||
const service = new B2Infrastructure({ pool: repo.pool, secrets: { read: async () => pkg },
|
||||
clientFactory: () => ({ async call(path, body) { calls.push({ path, body }); return { deleted: true, id: body.integration_id }; } }) });
|
||||
const input = { projectRef: `project:${projectId}`, hostRef: `host:${hostId}`, action: 'application-delete', integrationId: 'c'.repeat(32) };
|
||||
await assert.rejects(service.execute({ ...actor, hubRole: 'member', ownerScopes: [] }, input, '1'.repeat(32)), /device_owner_scope_access_denied/);
|
||||
await assert.rejects(service.execute(actor, { ...input, integrationId: '../foreign' }, '1'.repeat(32)), /b2_identifier_invalid/);
|
||||
await assert.rejects(service.execute(actor, { ...input, force: true }, '1'.repeat(32)), /b2_unexpected_field/);
|
||||
assert.equal(calls.length, 0);
|
||||
assert.deepEqual(await service.execute(actor, input, '1'.repeat(32)), { deleted: true, id: input.integrationId });
|
||||
assert.deepEqual(calls, [{ path: '/v2/management/applications/delete', body: { integration_id: input.integrationId } }]);
|
||||
assert.equal(repo.writes.at(-1).values[1], 'b2.application-delete');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user