{{this.labelString}}
- {{#if this.showInput}}
+ {{#if this.showToggleTextInput}}
{{@attr.options.subText}}
{{#if @attr.options.docLink}}
@@ -219,7 +239,7 @@
{{/if}}
- {{#if this.showInput}}
+ {{#if this.showToggleTextInput}}
{
assert.ok(true, 'rotate root called');
new Response(204);
@@ -119,12 +120,16 @@ module('Acceptance | database workflow', function (hooks) {
);
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
+ const valueSelector =
+ label === 'Skip initial rotation on static roles'
+ ? PAGE.infoRowValueDiv(label)
+ : PAGE.infoRowValue(label);
assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(PAGE.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
+ assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
});
});
test('create without rotate', async function (assert) {
- assert.expect(23);
+ assert.expect(25);
this.server.post('/:backend/rotate-root/:name', () => {
assert.notOk(true, 'rotate root called when it should not have been');
new Response(204);
@@ -152,12 +157,16 @@ module('Acceptance | database workflow', function (hooks) {
);
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
+ const valueSelector =
+ label === 'Skip initial rotation on static roles'
+ ? PAGE.infoRowValueDiv(label)
+ : PAGE.infoRowValue(label);
assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(PAGE.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
+ assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
});
});
test('create failure', async function (assert) {
- assert.expect(25);
+ assert.expect(27);
this.server.post('/:backend/rotate-root/:name', (schema, req) => {
const okay = req.params.name !== 'bad-connection';
assert.ok(okay, 'rotate root called but not for bad-connection');
@@ -192,8 +201,12 @@ module('Acceptance | database workflow', function (hooks) {
);
assert.dom(PAGE.infoRow).exists({ count: this.expectedRows.length }, 'correct number of rows');
this.expectedRows.forEach(({ label, value }) => {
+ const valueSelector =
+ label === 'Skip initial rotation on static roles'
+ ? PAGE.infoRowValueDiv(label)
+ : PAGE.infoRowValue(label);
assert.dom(PAGE.infoRowLabel(label)).hasText(label, `Label for ${label} is correct`);
- assert.dom(PAGE.infoRowValue(label)).hasText(value, `Value for ${label} is correct`);
+ assert.dom(valueSelector).hasText(value, `Value for ${label} is correct`);
});
});
diff --git a/ui/tests/integration/components/database-role-edit-test.js b/ui/tests/integration/components/database-role-edit-test.js
index 1fbbb089f2..62f46ef84a 100644
--- a/ui/tests/integration/components/database-role-edit-test.js
+++ b/ui/tests/integration/components/database-role-edit-test.js
@@ -94,7 +94,8 @@ module('Integration | Component | database-role-edit', function (hooks) {
await render(hbs``);
await fillIn('[data-test-ttl-value="Rotation period"]', '2');
- await click('[data-test-input="skip_import_rotation"]');
+ await click('[data-test-toggle-input="toggle-skip_import_rotation"]');
+
await click('[data-test-secret-save]');
await render(hbs``);
diff --git a/ui/tests/integration/components/database-role-setting-form-test.js b/ui/tests/integration/components/database-role-setting-form-test.js
index 0c64346c4b..5a2dc77dcb 100644
--- a/ui/tests/integration/components/database-role-setting-form-test.js
+++ b/ui/tests/integration/components/database-role-setting-form-test.js
@@ -11,59 +11,45 @@ import hbs from 'htmlbars-inline-precompile';
import { setRunOptions } from 'ember-a11y-testing/test-support';
const testCases = [
- {
- // default case should show all possible fields for each type
- pluginType: '',
- staticRoleFields: ['name', 'username', 'rotation_period', 'rotation_statements'],
- dynamicRoleFields: [
- 'name',
- 'default_ttl',
- 'max_ttl',
- 'creation_statements',
- 'revocation_statements',
- 'rollback_statements',
- 'renew_statements',
- ],
- },
{
pluginType: 'elasticsearch-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statement', 'default_ttl', 'max_ttl'],
},
{
pluginType: 'mongodb-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statement', 'revocation_statement', 'default_ttl', 'max_ttl'],
statementsHidden: true,
},
{
pluginType: 'mssql-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
},
{
pluginType: 'mysql-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
},
{
pluginType: 'mysql-aurora-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
},
{
pluginType: 'mysql-rds-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
},
{
pluginType: 'mysql-legacy-database-plugin',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
},
{
pluginType: 'vault-plugin-database-oracle',
- staticRoleFields: ['username', 'rotation_period'],
+ staticRoleFields: ['username', 'rotation_period', 'skip_import_rotation'],
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
},
];
@@ -73,6 +59,7 @@ const ALL_ATTRS = [
{ name: 'default_ttl', type: 'string', options: {} },
{ name: 'max_ttl', type: 'string', options: {} },
{ name: 'username', type: 'string', options: {} },
+ { name: 'skip_import_rotation', type: 'boolean', options: {} },
{ name: 'rotation_period', type: 'string', options: {} },
{ name: 'creation_statements', type: 'string', options: {} },
{ name: 'creation_statement', type: 'string', options: {} },
@@ -114,20 +101,19 @@ module('Integration | Component | database-role-setting-form', function (hooks)
test('it shows appropriate fields based on roleType and db plugin', async function (assert) {
this.set('roleType', 'static');
- this.set('dbType', '');
+ this.set('dbParams', { plugin_name: '', skip_static_role_rotation_import: false });
await render(hbs`
`);
- assert.dom('[data-test-component="empty-state"]').doesNotExist('Does not show empty states');
for (const testCase of testCases) {
const staticFields = getFields(testCase.staticRoleFields);
const dynamicFields = getFields(testCase.dynamicRoleFields);
- this.set('dbType', testCase.pluginType);
+ this.set('dbParams', { plugin_name: testCase.pluginType, skip_static_role_rotation_import: false });
this.set('roleType', 'static');
staticFields.show.forEach((attr) => {
assert
diff --git a/ui/tests/integration/components/form-field-test.js b/ui/tests/integration/components/form-field-test.js
index 03fbe516fe..ded69f0ee0 100644
--- a/ui/tests/integration/components/form-field-test.js
+++ b/ui/tests/integration/components/form-field-test.js
@@ -106,6 +106,26 @@ module('Integration | Component | form field', function (hooks) {
assert.ok(spy.calledWith('foo', 'hello'), 'onChange called with correct args');
});
+ test('it renders: toggleButton', async function (assert) {
+ const [model, spy] = await setup.call(
+ this,
+ createAttr('foobar', 'toggleButton', {
+ defaultValue: false,
+ editType: 'toggleButton',
+ helperTextEnabled: 'Toggled on',
+ helperTextDisabled: 'Toggled off',
+ })
+ );
+ assert.ok(component.hasToggleButton, 'renders a toggle button');
+ assert.dom('[data-test-toggle-input]').isNotChecked();
+ assert.dom('[data-test-toggle-subtext]').hasText('Toggled off');
+
+ await component.fields.objectAt(0).toggleButton();
+
+ assert.true(model.get('foobar'));
+ assert.ok(spy.calledWith('foobar', true), 'onChange called with correct args');
+ });
+
test('it renders: editType file', async function (assert) {
const subText = 'My subtext.';
await setup.call(this, createAttr('foo', 'string', { editType: 'file', subText, docLink: '/docs' }));
diff --git a/ui/tests/pages/components/form-field.js b/ui/tests/pages/components/form-field.js
index fb5f05fb29..94a26ac7d1 100644
--- a/ui/tests/pages/components/form-field.js
+++ b/ui/tests/pages/components/form-field.js
@@ -19,6 +19,7 @@ export default {
hasStringList: isPresent('[data-test-component=string-list]'),
hasTextFile: isPresent('[data-test-component=text-file]'),
hasTTLPicker: isPresent('[data-test-toggle-input="Foo"]'),
+ hasToggleButton: isPresent('[data-test-toggle-input="toggle-foobar"]'),
hasJSONEditor: isPresent('[data-test-component="code-mirror-modifier"]'),
hasJSONClearButton: isPresent('[data-test-json-clear-button]'),
hasInput: isPresent('input'),
@@ -36,6 +37,7 @@ export default {
fields: collection('[data-test-field]', {
clickLabel: clickable('label'),
toggleTtl: clickable('[data-test-toggle-input="Foo"]'),
+ toggleButton: clickable('[data-test-toggle-input="toggle-foobar"]'),
labelValue: text('[data-test-form-field-label]'),
input: fillable('input'),
ttlTime: fillable('[data-test-ttl-value]'),
diff --git a/ui/tests/unit/serializers/database/connection-test.js b/ui/tests/unit/serializers/database/connection-test.js
index 90445ea1e0..bf48250c59 100644
--- a/ui/tests/unit/serializers/database/connection-test.js
+++ b/ui/tests/unit/serializers/database/connection-test.js
@@ -26,6 +26,7 @@ module('Unit | Serializer | database/connection', function (hooks) {
url: 'http://localhost:9200',
username: 'elastic',
password: 'changeme',
+ skip_static_role_rotation_import: false,
tls_ca: 'some-value',
ca_cert: undefined, // does not send undefined values
});
@@ -38,6 +39,7 @@ module('Unit | Serializer | database/connection', function (hooks) {
url: 'http://localhost:9200',
username: 'elastic',
password: 'changeme',
+ skip_static_role_rotation_import: false,
insecure: false,
};