mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 15:11:07 +02:00
* updates api client vars to snake_case for custom messages * updates api client vars to snake_case for tools * updates api client vars to snake_case for sync * updates api client vars to snake_case for secrets engine * updates api client vars to snake_case for auth * updates api client vars to snake_case for usage * updates api client dep to point to gh repo * fixes custom-messages service unit tests * fixes configure-ssh test * fixes configure-ssh test...again
80 lines
2.4 KiB
JavaScript
80 lines
2.4 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
// creates destination and association model for use in sync integration tests
|
|
// ensure that setupMirage is used prior to setupModels since this.server is used
|
|
export function setupDataStubs(hooks) {
|
|
hooks.beforeEach(function () {
|
|
// most tests are good with the default data generated here
|
|
// allow for this to be overridden to test different types
|
|
this.setupStubsForType = (destType) => {
|
|
const {
|
|
id, // eslint-disable-line no-unused-vars
|
|
name,
|
|
type,
|
|
granularity,
|
|
secret_name_template,
|
|
custom_tags,
|
|
purge_initiated_at,
|
|
purge_error,
|
|
...connection_details
|
|
} = this.server.create('sync-destination', destType);
|
|
|
|
this.destination = {
|
|
name,
|
|
type,
|
|
connection_details,
|
|
options: {
|
|
granularity_level: granularity,
|
|
secret_name_template,
|
|
custom_tags,
|
|
},
|
|
purge_initiated_at,
|
|
purge_error,
|
|
};
|
|
|
|
this.destinations = [this.destination];
|
|
this.destinations.meta = {
|
|
filteredTotal: this.destinations.length,
|
|
currentPage: 1,
|
|
pageSize: 5,
|
|
};
|
|
|
|
const association = this.server.create('sync-association', {
|
|
type: this.destination.type,
|
|
name: this.destination.name,
|
|
mount: 'kv',
|
|
secret_name: 'my-secret',
|
|
sync_status: 'SYNCED',
|
|
updated_at: '2023-09-20T10:51:53.961861096', // removed tz offset so time is consistently displayed
|
|
});
|
|
this.association = {
|
|
...association,
|
|
destination_type: this.destination.type,
|
|
destination_name: this.destination.name,
|
|
};
|
|
this.associations = [this.association];
|
|
this.associations.meta = {
|
|
filteredTotal: this.associations.length,
|
|
currentPage: 1,
|
|
pageSize: 5,
|
|
};
|
|
|
|
const capabilitiesService = this.owner.lookup('service:capabilities');
|
|
const paths = [
|
|
capabilitiesService.pathFor('syncDestination', this.destination),
|
|
capabilitiesService.pathFor('syncSetAssociation', this.destination),
|
|
capabilitiesService.pathFor('syncRemoveAssociation', this.destination),
|
|
];
|
|
this.capabilities = paths.reduce((obj, path) => {
|
|
obj[path] = { canRead: true, canCreate: true, canUpdate: true, canDelete: true };
|
|
return obj;
|
|
}, {});
|
|
};
|
|
|
|
this.setupStubsForType('aws-sm');
|
|
});
|
|
}
|