From 174939aa43b8a356a019b20fd69080225da87bf8 Mon Sep 17 00:00:00 2001 From: Mark Adamcin Date: Thu, 2 Jun 2022 08:18:22 -0700 Subject: [PATCH 1/2] fix: ioc-4292. correct issues with entp bindings in console api spec --- spec/api.json | 19 ++++++++++++++----- src/index.js | 6 +++--- test/index.test.js | 6 +++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/spec/api.json b/spec/api.json index c6a8116..9524f67 100644 --- a/spec/api.json +++ b/spec/api.json @@ -3797,7 +3797,7 @@ ] } }, - "/console/organizations/{orgId}/integrations/{intId}/bindings": { + "/console/organizations/{orgId}/integrations/entp/{intId}/bindings": { "post": { "summary": "upload and bind certificate", "tags": [ @@ -3844,13 +3844,22 @@ "requestBody": { "required": true, "content": { - "application/json": { + "multipart/form-data": { "schema": { - "type": "file" + "type": "object", + "required": [ + "certificate" + ], + "properties": { + "certificate": { + "type": "string", + "format": "binary" + } + } } } }, - "description": "certificate" + "description": "form data" }, "responses": { "200": { @@ -4048,7 +4057,7 @@ ] } }, - "/console/organizations/{orgId}/integrations/{intId}/bindings/{bindingId}": { + "/console/organizations/{orgId}/integrations/entp/{intId}/bindings/{bindingId}": { "delete": { "summary": "delete binding", "tags": [ diff --git a/src/index.js b/src/index.js index 2767a8c..08993f1 100644 --- a/src/index.js +++ b/src/index.js @@ -951,7 +951,7 @@ class CoreConsoleAPI { try { const res = await this.sdk.apis.Organizations - .get_console_organizations__orgId__integrations__intId__bindings( + .get_console_organizations__orgId__integrations_entp__intId__bindings( ...this.__createRequestOptions(parameters) ) return res @@ -975,7 +975,7 @@ class CoreConsoleAPI { try { const res = await this.sdk.apis.Organizations - .post_console_organizations__orgId__integrations__intId__bindings( + .post_console_organizations__orgId__integrations_entp__intId__bindings( ...this.__createRequestOptions(parameters, requestBody) ) return res @@ -998,7 +998,7 @@ class CoreConsoleAPI { try { const res = await this.sdk.apis.Organizations - .delete_console_organizations__orgId__integrations__intId__bindings__bindingId_( + .delete_console_organizations__orgId__integrations_entp__intId__bindings__bindingId_( ...this.__createRequestOptions(parameters) ) return res diff --git a/test/index.test.js b/test/index.test.js index 15f5906..784bddf 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -695,7 +695,7 @@ test('getBindingsForIntegration', async () => { const apiOptions = createSwaggerOptions() await standardTest({ - fullyQualifiedApiName: 'Organizations.get_console_organizations__orgId__integrations__intId__bindings', + fullyQualifiedApiName: 'Organizations.get_console_organizations__orgId__integrations_entp__intId__bindings', sdkFunctionName: 'getBindingsForIntegration', apiParameters, apiOptions, @@ -713,7 +713,7 @@ test('uploadAndBindCertificate', async () => { const apiOptions = createSwaggerOptions({ certificate: 'certificate' }) await standardTest({ - fullyQualifiedApiName: 'Organizations.post_console_organizations__orgId__integrations__intId__bindings', + fullyQualifiedApiName: 'Organizations.post_console_organizations__orgId__integrations_entp__intId__bindings', sdkFunctionName: 'uploadAndBindCertificate', apiParameters, apiOptions, @@ -733,7 +733,7 @@ test('deleteBinding', async () => { const apiOptions = createSwaggerOptions() await standardTest({ - fullyQualifiedApiName: 'Organizations.delete_console_organizations__orgId__integrations__intId__bindings__bindingId_', + fullyQualifiedApiName: 'Organizations.delete_console_organizations__orgId__integrations_entp__intId__bindings__bindingId_', sdkFunctionName: 'deleteBinding', apiParameters, apiOptions, From 5741553e3636598cc6f5d9ea054b7e3cbf328c1e Mon Sep 17 00:00:00 2001 From: Mark Adamcin Date: Sun, 5 Jun 2022 15:47:51 -0700 Subject: [PATCH 2/2] IOC-4292 renable e2e test for uploadAndBindCertificate --- e2e/e2e.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/e2e/e2e.js b/e2e/e2e.js index 1d48b5a..6170ca8 100644 --- a/e2e/e2e.js +++ b/e2e/e2e.js @@ -456,20 +456,19 @@ describe('Workspace credential test', () => { expect(res.body.client_secrets).toBeDefined() }) - // commented out because endpoint returns 404 - tracked internally at IOC-4292 - // test('test uploadAndBindCertificate API', async () => { - // expect(credentialId).toBeDefined() // if not, createEnterpriseIntegration test failed + test('test uploadAndBindCertificate API', async () => { + expect(credentialId).toBeDefined() // if not, createEnterpriseIntegration test failed - // expect(orgId).toBeDefined() + expect(orgId).toBeDefined() - // const keyPair = cert.generate('aio-lib-console-e2e-additional-certificate', 365, { country: 'US', state: 'CA', locality: 'SF', organization: 'Adobe', unit: 'AdobeIO' }) - // const certFile = tmp.fileSync({ postfix: '.crt' }) - // fs.writeFileSync(certFile.fd, keyPair.cert) - // const res = await sdkClient.uploadAndBindCertificate(orgId, credentialId, fs.createReadStream(certFile.name)) - // expect(res.ok).toBe(true) - // expect(res.status).toBe(200) - // expect(typeof (res.body)).toBe('object') - // }) + const keyPair = cert.generate('aio-lib-console-e2e-additional-certificate', 365, { country: 'US', state: 'CA', locality: 'SF', organization: 'Adobe', unit: 'AdobeIO' }) + const certFile = tmp.fileSync({ postfix: '.crt' }) + fs.writeFileSync(certFile.fd, keyPair.cert) + const res = await sdkClient.uploadAndBindCertificate(orgId, credentialId, fs.createReadStream(certFile.name)) + expect(res.ok).toBe(true) + expect(res.status).toBe(200) + expect(typeof (res.body)).toBe('object') + }) // delete test('test deleteCredential API (integrationType: entp)', async () => {