mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-15 11:07:00 +02:00
* Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package. This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License. Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUS-1.1 * Fix test that expected exact offset on hcl file --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Sarah Thompson <sthompson@hashicorp.com> Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
83 lines
3.4 KiB
JavaScript
83 lines
3.4 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupRenderingTest } from 'ember-qunit';
|
|
import { render } from '@ember/test-helpers';
|
|
import { hbs } from 'ember-cli-htmlbars';
|
|
import { setupEngine } from 'ember-engines/test-support';
|
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
|
import { SELECTORS } from 'vault/tests/helpers/pki/overview';
|
|
|
|
module('Integration | Component | Page::PkiOverview', function (hooks) {
|
|
setupRenderingTest(hooks);
|
|
setupEngine(hooks, 'pki');
|
|
setupMirage(hooks);
|
|
|
|
hooks.beforeEach(function () {
|
|
this.store = this.owner.lookup('service:store');
|
|
this.secretMountPath = this.owner.lookup('service:secret-mount-path');
|
|
this.secretMountPath.currentPath = 'pki-test';
|
|
|
|
this.store.createRecord('pki/issuer', { issuerId: 'abcd-efgh' });
|
|
this.store.createRecord('pki/issuer', { issuerId: 'ijkl-mnop' });
|
|
this.store.createRecord('pki/role', { name: 'role-0' });
|
|
this.store.createRecord('pki/role', { name: 'role-1' });
|
|
this.store.createRecord('pki/role', { name: 'role-2' });
|
|
this.store.createRecord('pki/certificate/base', { serialNumber: '22:2222:22222:2222' });
|
|
this.store.createRecord('pki/certificate/base', { serialNumber: '33:3333:33333:3333' });
|
|
|
|
this.issuers = this.store.peekAll('pki/issuer');
|
|
this.roles = this.store.peekAll('pki/role');
|
|
this.engineId = 'pki';
|
|
});
|
|
|
|
test('shows the correct information on issuer card', async function (assert) {
|
|
await render(
|
|
hbs`<Page::PkiOverview @issuers={{this.issuers}} @roles={{this.roles}} @engine={{this.engineId}} />,`,
|
|
{ owner: this.engine }
|
|
);
|
|
assert.dom(SELECTORS.issuersCardTitle).hasText('Issuers');
|
|
assert.dom(SELECTORS.issuersCardOverviewNum).hasText('2');
|
|
assert.dom(SELECTORS.issuersCardLink).hasText('View issuers');
|
|
});
|
|
|
|
test('shows the correct information on roles card', async function (assert) {
|
|
await render(
|
|
hbs`<Page::PkiOverview @issuers={{this.issuers}} @roles={{this.roles}} @engine={{this.engineId}} />,`,
|
|
{ owner: this.engine }
|
|
);
|
|
assert.dom(SELECTORS.rolesCardTitle).hasText('Roles');
|
|
assert.dom(SELECTORS.rolesCardOverviewNum).hasText('3');
|
|
assert.dom(SELECTORS.rolesCardLink).hasText('View roles');
|
|
this.roles = 404;
|
|
await render(
|
|
hbs`<Page::PkiOverview @issuers={{this.issuers}} @roles={{this.roles}} @engine={{this.engineId}} />,`,
|
|
{ owner: this.engine }
|
|
);
|
|
assert.dom(SELECTORS.rolesCardOverviewNum).hasText('0');
|
|
});
|
|
|
|
test('shows the input search fields for View Certificates card', async function (assert) {
|
|
await render(
|
|
hbs`<Page::PkiOverview @issuers={{this.issuers}} @roles={{this.roles}} @engine={{this.engineId}} />,`,
|
|
{ owner: this.engine }
|
|
);
|
|
assert.dom(SELECTORS.issueCertificate).hasText('Issue certificate');
|
|
assert.dom(SELECTORS.issueCertificateInput).exists();
|
|
assert.dom(SELECTORS.issueCertificateButton).hasText('Issue');
|
|
});
|
|
|
|
test('shows the input search fields for Issue Certificates card', async function (assert) {
|
|
await render(
|
|
hbs`<Page::PkiOverview @issuers={{this.issuers}} @roles={{this.roles}} @engine={{this.engineId}} />,`,
|
|
{ owner: this.engine }
|
|
);
|
|
assert.dom(SELECTORS.viewCertificate).hasText('View certificate');
|
|
assert.dom(SELECTORS.viewCertificateInput).exists();
|
|
assert.dom(SELECTORS.viewCertificateButton).hasText('View');
|
|
});
|
|
});
|