mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-03 20:40:45 -05:00
* wip policy stanza builder * Implement add and delete new stanza functionality * refactor to use Set() * make copy updates, add callback functionality to pass policy to parent * move policy formatter to util, add test coverage * =separate acl-policy component into two smaller components, add automation snippets * reorganize utils, add test coverage * finish rename * reduce scope of builder * fix spacing * add a ns test, remove unused spacing var * rename arg Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
29 lines
1,014 B
JavaScript
29 lines
1,014 B
JavaScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
import { formatCli } from 'core/utils/code-generators/cli';
|
|
|
|
module('Integration | Util | code-generators/cli', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('formatCli: it formats CLI command with content', async function (assert) {
|
|
const content = `- <<EOT
|
|
path "secret/*" {
|
|
capabilities = ["read"]
|
|
}
|
|
EOT`;
|
|
const formatted = formatCli({ command: 'policy write my-policy', content: content });
|
|
const expected = `vault policy write my-policy ${content}`;
|
|
assert.strictEqual(formatted, expected, 'it formats CLI command with content');
|
|
});
|
|
|
|
test('formatCli: it handles empty content', async function (assert) {
|
|
const formatted = formatCli({ command: 'policy list', content: '' });
|
|
const expected = 'vault policy list';
|
|
assert.strictEqual(formatted, expected, 'it formats CLI command with empty content');
|
|
});
|
|
});
|