From 322b7f2ddada14b93f1806c2d50283018f0030b1 Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Thu, 6 Jun 2024 13:10:28 -0700 Subject: [PATCH] backport of UI: update PKI attrs (#27389) Co-authored-by: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> --- .../acceptance/open-api-path-help-test.js | 19 +++++++++-- .../helpers/openapi/expected-secret-attrs.js | 34 +++++++++---------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/ui/tests/acceptance/open-api-path-help-test.js b/ui/tests/acceptance/open-api-path-help-test.js index d700fd679ccf..af415a05b225 100644 --- a/ui/tests/acceptance/open-api-path-help-test.js +++ b/ui/tests/acceptance/open-api-path-help-test.js @@ -76,7 +76,15 @@ function secretEngineHelper(test, secretEngine) { const helpUrl = model.getHelpUrl(this.backend); const result = await this.pathHelp.getProps(helpUrl, this.backend); const expected = engineData[modelName]; - assert.deepEqual(result, expected, `getProps returns expected attributes for ${modelName}`); + // Expected values should be updated to match "actual" (result) + assert.deepEqual( + Object.keys(result), + Object.keys(expected), + `getProps returns expected attributes for ${modelName}` + ); + Object.keys(expected).forEach((attrName) => { + assert.deepEqual(result[attrName], expected[attrName], `${attrName} attribute details match`); + }); }); }); } @@ -94,7 +102,14 @@ function authEngineHelper(test, authBackend) { const helpUrl = model.getHelpUrl(this.mount); const result = await this.pathHelp.getProps(helpUrl, this.mount); const expected = authData[itemName]; - assert.deepEqual(result, expected, `getProps returns expected attributes for ${itemName}`); + assert.deepEqual( + Object.keys(result), + Object.keys(expected), + `getProps returns expected attributes for ${itemName}` + ); + Object.keys(expected).forEach((attrName) => { + assert.propEqual(result[attrName], expected[attrName], `${attrName} attribute details match`); + }); }); } else { test.skip(`generated-${itemName}-${authBackend} model`, async function (assert) { diff --git a/ui/tests/helpers/openapi/expected-secret-attrs.js b/ui/tests/helpers/openapi/expected-secret-attrs.js index b654810131b2..73ef2955d9c8 100644 --- a/ui/tests/helpers/openapi/expected-secret-attrs.js +++ b/ui/tests/helpers/openapi/expected-secret-attrs.js @@ -594,6 +594,14 @@ const pki = { label: 'DNS/Email Subject Alternative Names (SANs)', type: 'string', }, + certMetadata: { + editType: 'string', + fieldGroup: 'default', + helpText: + "User supplied metadata to store associated with this certificate's serial number, base64 encoded", + label: 'Certificate Metadata', + type: 'string', + }, commonName: { editType: 'string', helpText: @@ -631,14 +639,6 @@ const pki = { fieldGroup: 'default', type: 'string', }, - metadata: { - editType: 'string', - fieldGroup: 'default', - helpText: - "User supplied metadata to store associated with this certificate's serial number, base64 encoded", - label: 'Metadata', - type: 'string', - }, notAfter: { editType: 'string', helpText: @@ -714,6 +714,14 @@ const pki = { label: 'DNS/Email Subject Alternative Names (SANs)', type: 'string', }, + certMetadata: { + editType: 'string', + fieldGroup: 'default', + helpText: + "User supplied metadata to store associated with this certificate's serial number, base64 encoded", + label: 'Certificate Metadata', + type: 'string', + }, commonName: { editType: 'string', helpText: @@ -757,14 +765,6 @@ const pki = { fieldGroup: 'default', type: 'string', }, - metadata: { - editType: 'string', - fieldGroup: 'default', - helpText: - "User supplied metadata to store associated with this certificate's serial number, base64 encoded", - label: 'Metadata', - type: 'string', - }, notAfter: { editType: 'string', helpText: @@ -1071,7 +1071,7 @@ const pki = { noStoreMetadata: { editType: 'boolean', helpText: - 'If set, if a client attempts to issue or sign a certificate with attached metadata to store, the issuance / signing instead fails.', + 'If set, if a client attempts to issue or sign a certificate with attached cert_metadata to store, the issuance / signing instead fails.', fieldGroup: 'default', type: 'boolean', },