test: 💍 update list credential tests (#1528)

* test: 💍 update list credential tests

✅ Closes: ICU-6807

* refactor: 💡 fix JSON variable naming
This commit is contained in:
Cameron Perera authored and GitHub committed 2022-12-13 15:56:03 -06:00
1 parent fb89cbb4cf
commit d98a85e2f4
1 file changed
+8 -2
@@ -16,6 +16,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
staticCredentialStore: null, staticCredentialStore: null,
usernamePasswordCredential: null, usernamePasswordCredential: null,
usernameKeyPairCredential: null, usernameKeyPairCredential: null,
jsonCredential: null,
}; };
const urls = { const urls = {
@@ -50,6 +51,11 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
credentialStore: instances.staticCredentialStore, credentialStore: instances.staticCredentialStore,
type: 'ssh_private_key', type: 'ssh_private_key',
}); });
instances.jsonCredential = this.server.create('credential', {
scope: instances.scopes.project,
credentialStore: instances.staticCredentialStore,
type: 'json',
});
// Generate route URLs for resources // Generate route URLs for resources
urls.projectScope = `/scopes/${instances.scopes.project.id}`; urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.credentialStores = `${urls.projectScope}/credential-stores`; urls.credentialStores = `${urls.projectScope}/credential-stores`;
@@ -75,7 +81,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
.isVisible({ count: this.server.schema.credentials.all().models.length }); .isVisible({ count: this.server.schema.credentials.all().models.length });
}); });
test('User cannot navigate to index without either list or create action', async function (assert) { test('User cannot navigate to Credentials tab without either list or create action', async function (assert) {
assert.expect(3); assert.expect(3);
instances.staticCredentialStore.authorized_collection_actions.credentials = instances.staticCredentialStore.authorized_collection_actions.credentials =
[]; [];
@@ -93,7 +99,7 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
assert.dom('.rose-nav-tabs a:nth-child(2)').doesNotExist(); assert.dom('.rose-nav-tabs a:nth-child(2)').doesNotExist();
}); });
test('User can navigate to index with only create action', async function (assert) { test('User can navigate to new credential screen with only create action', async function (assert) {
assert.expect(2); assert.expect(2);
instances.staticCredentialStore.authorized_collection_actions.credentials = instances.staticCredentialStore.authorized_collection_actions.credentials =
['create']; ['create'];