2018-09-25 16:28:26 +00:00
|
|
|
import { currentURL } 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/policy/edit';
|
2018-09-25 16:28:26 +00:00
|
|
|
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 | policy/acl/:name/edit', 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 list if navigating to root', async function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
await page.visit({ type: 'acl', name: 'root' });
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(
|
|
|
|
currentURL(),
|
|
|
|
'/vault/policies/acl',
|
|
|
|
'navigation to root show redirects you to policy list'
|
|
|
|
);
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it does not show delete for default policy', async function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
await page.visit({ type: 'acl', name: 'default' });
|
2018-04-03 14:16:57 +00:00
|
|
|
assert.notOk(page.deleteIsPresent, 'there is no delete button');
|
|
|
|
});
|
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
test('it navigates to show when the toggle is clicked', async function (assert) {
|
2018-09-25 16:28:26 +00:00
|
|
|
await page.visit({ type: 'acl', name: 'default' }).toggleEdit();
|
2022-10-18 15:46:02 +00:00
|
|
|
assert.strictEqual(currentURL(), '/vault/policy/acl/default', 'toggle navigates from edit to show');
|
2018-04-03 14:16:57 +00:00
|
|
|
});
|
|
|
|
});
|