chore: 🤖 rename credential source custom methods

This commit is contained in:
Randall Morey committed 2021-09-22 18:34:35 -04:00
1 parent 8b09f132e0
commit 77420d29c6
3 files changed
+10 -10

No files matched your search

+5 -5
View File
@@ -152,7 +152,7 @@ export default class TargetModel extends GeneratedTargetModel {
}
/**
* Adds credential libraries via the `add-credential-libraries` method.
* Adds credential libraries via the `add-credential-sources` method.
* See serializer and adapter for more information.
* @param {[string]} credentialLibraryIDs
* @param {object} options
@@ -161,7 +161,7 @@ export default class TargetModel extends GeneratedTargetModel {
*/
addCredentialSources(credentialLibraryIDs, options = { adapterOptions: {} }) {
const defaultAdapterOptions = {
method: 'add-credential-libraries',
method: 'add-credential-sources',
credentialLibraryIDs,
};
// There is no "deep merge" in ES.
@@ -175,7 +175,7 @@ export default class TargetModel extends GeneratedTargetModel {
}
/**
* Delete credential libraries via the `remove-credential-libraries` method.
* Delete credential libraries via the `remove-credential-sources` method.
* See serializer and adapter for more information.
* @param {[string]} credentialLibraryIDs
* @param {object} options
@@ -187,7 +187,7 @@ export default class TargetModel extends GeneratedTargetModel {
options = { adapterOptions: {} }
) {
const defaultAdapterOptions = {
method: 'remove-credential-libraries',
method: 'remove-credential-sources',
credentialLibraryIDs,
};
// There is no "deep merge" in ES.
@@ -201,7 +201,7 @@ export default class TargetModel extends GeneratedTargetModel {
}
/**
* Delete a single credential library set via the `remove-credential-libraries` method.
* Delete a single credential library set via the `remove-credential-sources` method.
* @param {number} credentialLibraryID
* @param {object} options
* @return {Promise}
+2 -2
View File
@@ -384,7 +384,7 @@ export default function () {
});
}
// If adding credential libraries, push them into the array
if (method === 'add-credential-libraries') {
if (method === 'add-credential-sources') {
updatedAttrs.credentialLibraryIds = target.credentialLibraryIds;
attrs.applicationCredentialSourceIds.forEach((id) => {
if (!updatedAttrs.credentialLibraryIds.includes(id)) {
@@ -393,7 +393,7 @@ export default function () {
});
}
// If deleting credential libraries, filter them out of the array
if (method === 'remove-credential-libraries') {
if (method === 'remove-credential-sources') {
updatedAttrs.credentialLibraryIds = target.credentialLibraryIds;
updatedAttrs.credentialLibraryIds =
updatedAttrs.credentialLibraryIds.filter((id) => {
+3 -3
View File
@@ -283,7 +283,7 @@ module('Unit | Model | target', function (hooks) {
test('it has an `addCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post(
'/v1/targets/123abc:add-credential-libraries',
'/v1/targets/123abc:add-credential-sources',
(schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
@@ -317,7 +317,7 @@ module('Unit | Model | target', function (hooks) {
test('it has a `removeCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post(
'/v1/targets/123abc:remove-credential-libraries',
'/v1/targets/123abc:remove-credential-sources',
(schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {
@@ -351,7 +351,7 @@ module('Unit | Model | target', function (hooks) {
test('it has a `removeCredentialSource` method that deletes a single credential library using `removeCredentialSources` method', async function (assert) {
assert.expect(1);
this.server.post(
'/v1/targets/123abc:remove-credential-libraries',
'/v1/targets/123abc:remove-credential-sources',
(schema, request) => {
const body = JSON.parse(request.requestBody);
assert.deepEqual(body, {