feat: 🎸 add support for dynamic credentials in storage bucket (#1897)

* feat: 🎸 add support for dynamic credentials in storage bucket
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2023-09-18 13:26:38 -07:00
1 parent 3cb8417a89
commit 4910070c95
13 files changed
+420 -96

No files matched your search

@@ -5,7 +5,11 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3 } from 'api/models/storage-bucket';
import {
TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3,
TYPE_CREDENTIAL_DYNAMIC,
TYPE_CREDENTIAL_STATIC,
} from 'api/models/storage-bucket';
module('Unit | Model | storage bucket', function (hooks) {
setupTest(hooks);
@@ -41,6 +45,21 @@ module('Unit | Model | storage bucket', function (hooks) {
assert.true(modelB.isUnknown);
});
test('it has credentialType property and returns the expected values', async function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');
const modelA = store.createRecord('storage-bucket', {
role_arn: 'test-role-arn',
access_key_id: null,
});
const modelB = store.createRecord('storage-bucket', {
role_arn: null,
access_key_id: 'test-access-key-id',
});
assert.strictEqual(modelA.credentialType, TYPE_CREDENTIAL_DYNAMIC);
assert.strictEqual(modelB.credentialType, TYPE_CREDENTIAL_STATIC);
});
test('it has isAWS property and returns the expected values', async function (assert) {
assert.expect(2);
const store = this.owner.lookup('service:store');