Skip to content

Commit f454c8d

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
test(credentials): align OCI v2 coverage with shared suite
1 parent 07c52fc commit f454c8d

2 files changed

Lines changed: 36 additions & 84 deletions

File tree

apps/sim/app/api/v2/credentials/route.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,42 @@ describe('POST /api/v2/credentials', () => {
293293
})
294294
})
295295

296+
it('forwards OCI Object Storage credential fields without returning secrets', async () => {
297+
const request = new NextRequest('http://localhost:3000/api/v2/credentials', {
298+
method: 'POST',
299+
headers: { 'content-type': 'application/json' },
300+
body: JSON.stringify({
301+
workspaceId: WORKSPACE_ID,
302+
type: 'service_account',
303+
providerId: 'oci-object-storage-service-account',
304+
credentials: JSON.stringify({
305+
accessKeyId: 'access-key-canary',
306+
secretAccessKey: 'secret-key-canary',
307+
namespace: 'namespace1',
308+
region: 'us-ashburn-1',
309+
}),
310+
}),
311+
})
312+
const response = await POST(request)
313+
const body = await response.text()
314+
315+
expect(response.status).toBe(201)
316+
expect(body).not.toContain('key-canary')
317+
expect(body).not.toContain('namespace1')
318+
expect(mocks.create).toHaveBeenCalledWith({
319+
principal: { kind: 'personal_api_key', userId: 'user-1', keyId: 'key-1' },
320+
input: expect.objectContaining({
321+
workspaceId: WORKSPACE_ID,
322+
providerId: 'oci-object-storage-service-account',
323+
accessKeyId: 'access-key-canary',
324+
secretAccessKey: 'secret-key-canary',
325+
namespace: 'namespace1',
326+
region: 'us-ashburn-1',
327+
}),
328+
request,
329+
})
330+
})
331+
296332
it('rejects an unknown service-account provider before the use case', async () => {
297333
const response = await POST(
298334
new NextRequest('http://localhost:3000/api/v2/credentials', {

apps/sim/lib/api/contracts/v2/credentials-oci.test.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)