vault/ui/tests/unit/components/mount/secrets-engine-form-test.js
Vault Automation af07b60f99
[VAULT-33083] support mount external engine (#11659) (#12284)
* [VAULT-33083] support mount external engine

* add "Plugin type" and "Plugin version" fields to the enable mount page

* add changelog

* address copilot review comments

* address PR comments, code cleanup

* fix test failures

* Add support for external plugins registered without a plugin version

* external plugin should be enabled for enterprise only, plugin version should be mandatory for external plugins

* fix tests

* address copilot feedback

* fix failing tests, add unit test coverage

* address PR comments

* address PR comments

* remove dead code

* move no external versions alert

* Only show un-versioned plugin message if there are un-versioned plugins in the catalog.

* address PR comments

* use ApiService instead of custom PluginPinsService; fix failing tests

* revert changes to forms/mount.ts and forms/auth/method.ts

Co-authored-by: Shannon Roberts (Beagin) <beagins@users.noreply.github.com>
2026-02-10 14:18:14 -08:00

44 lines
1.4 KiB
JavaScript

/**
* Copyright IBM Corp. 2016, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import { setupTest } from 'ember-qunit';
import { module, test } from 'qunit';
import SecretsEngineForm from 'vault/forms/secrets/engine';
import { getExternalPluginNameFromBuiltin } from 'vault/utils/external-plugin-helpers';
module('Unit | Component | mount/secrets-engine-form', function (hooks) {
setupTest(hooks);
hooks.beforeEach(function () {
// Setup default model
const defaults = {
config: { listing_visibility: false },
options: { version: 2 },
};
this.model = new SecretsEngineForm(defaults, { isNew: true });
this.model.type = 'keymgmt';
this.model.data.path = 'keymgmt';
this.availableVersions = [
{ version: '1.0.0', isBuiltin: false },
{ version: '1.1.0', isBuiltin: false },
{ version: '2.0.0', isBuiltin: false },
{ version: '', isBuiltin: true },
];
});
test('getExternalPluginNameFromBuiltin returns correct name for keymgmt', function (assert) {
const externalName = getExternalPluginNameFromBuiltin('keymgmt');
assert.strictEqual(
externalName,
'vault-plugin-secrets-keymgmt',
'generates correct external plugin name for keymgmt'
);
});
test('model normalizedType returns correct value', function (assert) {
assert.strictEqual(this.model.normalizedType, 'keymgmt', 'returns correct normalized type');
});
});