mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
Fixed mfa method acceptance tests (#15756)
This commit is contained in:
parent
833bc0812c
commit
0cc19c479f
4 changed files with 14 additions and 8 deletions
|
|
@ -145,14 +145,14 @@ export default class MfaMethod extends Model {
|
|||
@attr('number', {
|
||||
label: 'Digits',
|
||||
editType: 'radio',
|
||||
possibleValues: ['6', '8'],
|
||||
possibleValues: [6, 8],
|
||||
subText: 'The number digits in the generated TOTP code.',
|
||||
})
|
||||
digits;
|
||||
@attr('number', {
|
||||
label: 'Skew',
|
||||
editType: 'radio',
|
||||
possibleValues: ['0', '1'],
|
||||
possibleValues: [0, 1],
|
||||
subText: 'The number of delay periods allowed when validating a TOTP token.',
|
||||
})
|
||||
skew;
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@
|
|||
<RadioButton
|
||||
class="radio"
|
||||
name={{@attr.name}}
|
||||
id={{dasherize (or val.value val)}}
|
||||
id={{or val.value val}}
|
||||
value={{or val.value val}}
|
||||
@value={{or val.value val}}
|
||||
@onChange={{this.setAndBroadcast}}
|
||||
@groupValue={{(get @model this.valuePath)}}
|
||||
/>
|
||||
<label for={{dasherize (or val.value val)}} class="has-left-margin-xs">
|
||||
<label for={{or val.value val}} class="has-left-margin-xs">
|
||||
{{or val.value val}}
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -263,6 +263,11 @@ module('Acceptance | mfa-method', function (hooks) {
|
|||
.dom('[data-test-ttl-value="Period"]')
|
||||
.hasValue(model.period.toString(), 'Period form field is populated with model value');
|
||||
assert.dom('[data-test-select="ttl-unit"]').hasValue('s', 'Correct time unit is shown for period');
|
||||
} else if (key === 'algorithm' || key === 'digits' || key === 'skew') {
|
||||
let radioElem = this.element.querySelector(`input[name=${key}]:checked`);
|
||||
assert
|
||||
.dom(radioElem)
|
||||
.hasValue(model[key].toString(), `${key} form field is populated with model value`);
|
||||
} else {
|
||||
assert
|
||||
.dom(`[data-test-input="${key}"]`)
|
||||
|
|
@ -271,14 +276,15 @@ module('Acceptance | mfa-method', function (hooks) {
|
|||
});
|
||||
|
||||
await fillIn('[data-test-input="issuer"]', 'foo');
|
||||
await fillIn('[data-test-input="algorithm"]', 'SHA512');
|
||||
let SHA1radioBtn = this.element.querySelectorAll('input[name=algorithm]')[0];
|
||||
await click(SHA1radioBtn);
|
||||
await fillIn('[data-test-input="max_validation_attempts"]', 10);
|
||||
await click('[data-test-mfa-method-save]');
|
||||
await fillIn('[data-test-confirmation-modal-input]', model.type);
|
||||
await click('[data-test-confirm-button]');
|
||||
|
||||
assert.dom('[data-test-row-value="Issuer"]').hasText('foo', 'Issuer field is updated');
|
||||
assert.dom('[data-test-row-value="Algorithm"]').hasText('SHA512', 'Algorithm field is updated');
|
||||
assert.dom('[data-test-row-value="Algorithm"]').hasText('SHA1', 'Algorithm field is updated');
|
||||
assert
|
||||
.dom('[data-test-row-value="Max validation attempts"]')
|
||||
.hasText('10', 'Max validation attempts field is updated');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import EmberObject from '@ember/object';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { dasherize } from '@ember/string';
|
||||
import { render, click, fillIn } from '@ember/test-helpers';
|
||||
import hbs from 'htmlbars-inline-precompile';
|
||||
import { create } from 'ember-cli-page-object';
|
||||
|
|
@ -138,7 +137,7 @@ module('Integration | Component | form field', function (hooks) {
|
|||
);
|
||||
assert.ok(component.hasRadio, 'renders radio buttons');
|
||||
const selectedValue = 'SHA256';
|
||||
await component.selectRadioInput(dasherize(selectedValue));
|
||||
await component.selectRadioInput(selectedValue);
|
||||
assert.equal(model.get('foo'), selectedValue);
|
||||
assert.ok(spy.calledWith('foo', selectedValue), 'onChange called with correct args');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue