mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-10 00:27:02 +02:00
* http://localhost:4200/ui/vault/secrets/kubernetes/kubernetes/roles/test/details readOnly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/policies/acl/create readonly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/policy/acl/default readonly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/access/oidc/scopes/test/details readonly JsonEditor to Hds::CodeBlock * http://localhost:4200/ui/vault/access/oidc/scopes/create readonly JsonEditor to Hds::CodeBlock * fix (some) tests * fix remaining tests * add changelog
99 lines
3.0 KiB
JavaScript
99 lines
3.0 KiB
JavaScript
/**
|
||
* Copyright (c) HashiCorp, Inc.
|
||
* SPDX-License-Identifier: BUSL-1.1
|
||
*/
|
||
|
||
import { module, test } from 'qunit';
|
||
import { setupRenderingTest } from 'vault/tests/helpers';
|
||
import { render } from '@ember/test-helpers';
|
||
import { hbs } from 'ember-cli-htmlbars';
|
||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||
|
||
const SELECTORS = {
|
||
policyText: '[data-test-modal-title]',
|
||
policyDescription: (type) => `[data-test-example-modal-text=${type}]`,
|
||
jsonText: '.hds-code-block',
|
||
informationLink: '[data-test-example-modal-information-link]',
|
||
};
|
||
|
||
module('Integration | Component | policy-example', function (hooks) {
|
||
setupRenderingTest(hooks);
|
||
|
||
hooks.beforeEach(function () {
|
||
setRunOptions({
|
||
rules: {
|
||
// failing on .CodeMirror-scroll
|
||
'scrollable-region-focusable': { enabled: false },
|
||
},
|
||
});
|
||
});
|
||
|
||
test('it renders the correct paragraph for ACL policy', async function (assert) {
|
||
await render(hbs`
|
||
<PolicyExample
|
||
@policyType="acl"
|
||
/>
|
||
`);
|
||
assert
|
||
.dom(SELECTORS.policyDescription('acl'))
|
||
.hasText(
|
||
'ACL Policies are written in Hashicorp Configuration Language ( HCL ) or JSON and describe which paths in Vault a user or machine is allowed to access. Here is an example policy:'
|
||
);
|
||
});
|
||
|
||
test('it renders the correct paragraph for RGP policy', async function (assert) {
|
||
await render(hbs`
|
||
<PolicyExample
|
||
@policyType="rgp"
|
||
/>
|
||
`);
|
||
assert
|
||
.dom(SELECTORS.policyDescription('rgp'))
|
||
.hasText(
|
||
'Role Governing Policies (RGPs) are tied to client tokens or identities which is similar to ACL policies. They use Sentinel as a language framework to enable fine-grained policy decisions.'
|
||
);
|
||
});
|
||
|
||
test('it renders the correct paragraph for EGP policy', async function (assert) {
|
||
await render(hbs`
|
||
<PolicyExample
|
||
@policyType="egp"
|
||
/>
|
||
`);
|
||
assert
|
||
.dom(SELECTORS.policyDescription('egp'))
|
||
.hasText(
|
||
`Endpoint Governing Policies (EGPs) are tied to particular paths (e.g. aws/creds/ ) instead of tokens. They use Sentinel as a language to access properties of the incoming requests.`
|
||
);
|
||
});
|
||
|
||
test('it renders the correct JSON editor text for ACL policy', async function (assert) {
|
||
await render(hbs`
|
||
<PolicyExample
|
||
@policyType="acl"
|
||
/>
|
||
`);
|
||
assert.dom(SELECTORS.jsonText).includesText(`# Grant 'create', 'read' , 'update', and ‘list’ permission`);
|
||
});
|
||
|
||
test('it renders the correct JSON editor text for RGP policy', async function (assert) {
|
||
await render(hbs`
|
||
<PolicyExample
|
||
@policyType="rgp"
|
||
/>
|
||
`);
|
||
assert
|
||
.dom(SELECTORS.jsonText)
|
||
.includesText(`# Import strings library that exposes common string operations`);
|
||
});
|
||
|
||
test('it renders the correct JSON editor text for EGP policy', async function (assert) {
|
||
await render(hbs`
|
||
<PolicyExample
|
||
@policyType="egp"
|
||
/>
|
||
`);
|
||
assert.dom(SELECTORS.jsonText).includesText(`# Expect requests to only happen during work days (Monday`);
|
||
});
|
||
});
|