open-vault/ui/tests/acceptance/wrapped-token-test.js
Angel Garbarino 2e35e9578c
UI/obscure secret on input (#11284)
* new font and add as font-family to be used in masked-input

* clean up logic

* refactor for displayOnly

* start cert masking

* work on certificates

* upload cert work

* fix global styling

* fix styling for class no longer used

* make mask by default and remove option

* glimmerize start and certificate on LDAP a file field

* glimmerize actions

* first part of glimmerizing text-file still need to do some clean up

* not doing awesome over here

* getting ready to un-glimmer

* unglimmerize

* remove placeholder based on conversations with design

* clean up text-file

* cleanup

* fix class bindings

* handle class binding

* set up for test

* fix elementId

* track down index

* update masked-input test

* add more to the masked-input test

* test-file test

* fix broken test

* clear old style

* clean up

* remove pgp key masked font, this really needs to be refactored to text-file component

* changelog

* cover other certificate view

* add allowCopy

* address some pr styling comments

* improve test coverage

* fix some issues

* add attr.options.masked
2021-04-22 08:58:37 -06:00

45 lines
1.5 KiB
JavaScript

import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { settled, currentURL } from '@ember/test-helpers';
import { create } from 'ember-cli-page-object';
import auth from 'vault/tests/pages/auth';
import consoleClass from 'vault/tests/pages/components/console/ui-panel';
const consoleComponent = create(consoleClass);
const wrappedAuth = async () => {
await consoleComponent.runCommands(`write -field=token auth/token/create policies=default -wrap-ttl=3m`);
await settled();
return consoleComponent.lastLogOutput;
};
const setupWrapping = async () => {
await auth.logout();
await settled();
await auth.visit();
await settled();
await auth.tokenInput('root').submit();
await settled();
let token = await wrappedAuth();
await auth.logout();
await settled();
return token;
};
module('Acceptance | wrapped_token query param functionality', function(hooks) {
setupApplicationTest(hooks);
test('it authenticates you if the query param is present', async function(assert) {
let token = await setupWrapping();
await auth.visit({ wrapped_token: token });
await settled();
assert.equal(currentURL(), '/vault/secrets', 'authenticates and redirects to home');
});
test('it authenticates when used with the with=token query param', async function(assert) {
let token = await setupWrapping();
await auth.visit({ wrapped_token: token, with: 'token' });
await settled();
assert.equal(currentURL(), '/vault/secrets', 'authenticates and redirects to home');
});
});