open-vault/ui/tests/acceptance/settings/auth/enable-test.js

37 lines
1.2 KiB
JavaScript
Raw Normal View History

import { currentRouteName } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
2018-04-03 14:16:57 +00:00
import page from 'vault/tests/pages/settings/auth/enable';
import listPage from 'vault/tests/pages/access/methods';
import authPage from 'vault/tests/pages/auth';
2018-04-03 14:16:57 +00:00
module('Acceptance | settings/auth/enable', function(hooks) {
setupApplicationTest(hooks);
2018-04-03 14:16:57 +00:00
hooks.beforeEach(function() {
return authPage.login();
2018-04-03 14:16:57 +00:00
});
test('it mounts and redirects', async function(assert) {
// always force the new mount to the top of the list
const path = `approle-${new Date().getTime()}`;
const type = 'approle';
await page.visit();
assert.equal(currentRouteName(), 'vault.cluster.settings.auth.enable');
await page.enable(type, path);
assert.equal(
page.flash.latestMessage,
`Successfully mounted the ${type} auth method at ${path}.`,
'success flash shows'
);
2018-04-03 14:16:57 +00:00
assert.equal(
currentRouteName(),
2019-02-14 18:52:34 +00:00
'vault.cluster.settings.auth.configure.section',
'redirects to the auth config page'
2018-04-03 14:16:57 +00:00
);
2019-02-14 18:52:34 +00:00
await listPage.visit();
assert.ok(listPage.findLinkById(path), 'mount is present in the list');
2018-04-03 14:16:57 +00:00
});
});