open-vault/ui/tests/acceptance/policies-test.js

29 lines
1 KiB
JavaScript
Raw Normal View History

import { currentURL, currentRouteName, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import authPage from 'vault/tests/pages/auth';
2018-04-03 14:16:57 +00:00
module('Acceptance | policies', function(hooks) {
setupApplicationTest(hooks);
hooks.beforeEach(function() {
return authPage.login();
});
2018-04-03 14:16:57 +00:00
test('it redirects to acls on unknown policy type', async function(assert) {
await visit('/vault/policy/foo/default');
2018-04-03 14:16:57 +00:00
assert.equal(currentRouteName(), 'vault.cluster.policies.index');
assert.equal(currentURL(), '/vault/policies/acl');
await visit('/vault/policy/foo/default/edit');
2018-04-03 14:16:57 +00:00
assert.equal(currentRouteName(), 'vault.cluster.policies.index');
assert.equal(currentURL(), '/vault/policies/acl');
});
test('it redirects to acls on index navigation', async function(assert) {
await visit('/vault/policy/acl');
2018-04-03 14:16:57 +00:00
assert.equal(currentRouteName(), 'vault.cluster.policies.index');
assert.equal(currentURL(), '/vault/policies/acl');
});
});