2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
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
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
module('Acceptance | policies', function (hooks) {
|
2018-09-25 16:28:26 +00:00
|
|
|
setupApplicationTest(hooks);
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
hooks.beforeEach(function () {
|
2018-09-25 16:28:26 +00:00
|
|
|
return authPage.login();
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it redirects to acls on unknown policy type', async function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
await visit('/vault/policy/foo/default');
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(currentRouteName(), 'vault.cluster.policies.index');
|
|
|
|
assert.strictEqual(currentURL(), '/vault/policies/acl');
|
2018-04-03 14:16:57 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
await visit('/vault/policy/foo/default/edit');
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(currentRouteName(), 'vault.cluster.policies.index');
|
|
|
|
assert.strictEqual(currentURL(), '/vault/policies/acl');
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it redirects to acls on index navigation', async function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
await visit('/vault/policy/acl');
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(currentRouteName(), 'vault.cluster.policies.index');
|
|
|
|
assert.strictEqual(currentURL(), '/vault/policies/acl');
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
});
|