vault/ui/tests/integration/components/pki/page/pki-tidy-auto-settings-test.js
hashicorp-copywrite[bot] 0b12cdcfd1
[COMPLIANCE] License changes (#22290)
* 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>
2023-08-10 18:14:03 -07:00

73 lines
2.6 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 { setupEngine } from 'ember-engines/test-support';
module('Integration | Component | page/pki-tidy-auto-settings', function (hooks) {
setupRenderingTest(hooks);
setupEngine(hooks, 'pki');
hooks.beforeEach(function () {
const backend = 'pki-auto-tidy';
this.backend = backend;
this.context = { owner: this.engine };
this.store = this.owner.lookup('service:store');
this.breadcrumbs = [
{ label: 'secrets', route: 'secrets', linkExternal: true },
{ label: backend, route: 'overview' },
{ label: 'tidy', route: 'tidy.index' },
{ label: 'auto' },
];
});
test('it renders', async function (assert) {
const model = this.store.createRecord('pki/tidy', {
backend: this.backend,
tidyType: 'auto',
enabled: false,
intervalDuration: '2d',
tidyCertStore: false,
tidyExpiredIssuers: true,
});
this.set('model', model);
await render(
hbs`<Page::PkiTidyAutoSettings @breadcrumbs={{this.breadcrumbs}} @model={{this.model}} />`,
this.context
);
assert.dom('[data-test-breadcrumbs] li').exists({ count: 4 }, 'an item exists for each breadcrumb');
assert.dom('[data-test-header-title]').hasText('Automatic Tidy Configuration', 'title is correct');
assert
.dom('[data-test-pki-edit-tidy-auto-link]')
.hasText('Edit auto-tidy', 'toolbar edit link has correct text');
assert.dom('[data-test-row="enabled"] [data-test-label-div]').hasText('Automatic tidy enabled');
assert.dom('[data-test-row="intervalDuration"] [data-test-label-div]').hasText('Automatic tidy duration');
// Universal operations
assert.dom('[data-test-group-title="Universal operations"]').hasText('Universal operations');
assert
.dom('[data-test-value-div="Tidy the certificate store"]')
.exists('Renders universal field when value exists');
assert
.dom('[data-test-value-div="Tidy revoked certificates"]')
.doesNotExist('Does not render universal field when value null');
// Issuer operations
assert.dom('[data-test-group-title="Issuer operations"]').hasText('Issuer operations');
assert
.dom('[data-test-value-div="Tidy expired issuers"]')
.exists('Renders issuer op field when value exists');
assert
.dom('[data-test-value-div="Tidy legacy CA bundle"]')
.doesNotExist('Does not render issuer op field when value null');
});
});