updated fixtures to use proper organization linking

This commit is contained in:
Daniel Sami 2018-10-31 11:03:44 -04:00
parent 484ef1b6a8
commit 5da13683ce

View File

@ -146,14 +146,14 @@ const getAdminMachineCredential = (namespace = session) => {
};
const getTeam = (namespace = session) => getOrganization(namespace)
.then(organization => getOrCreate('/teams/', {
.then(organization => getOrCreate(`/organizations/${organization.id}/teams/`, {
name: `${namespace}-team`,
description: namespace,
organization: organization.id,
}));
const getSmartInventory = (namespace = session) => getOrganization(namespace)
.then(organization => getOrCreate('/inventories/', {
.then(organization => getOrCreate(`/inventories/`, {
name: `${namespace}-smart-inventory`,
description: namespace,
organization: organization.id,
@ -162,7 +162,7 @@ const getSmartInventory = (namespace = session) => getOrganization(namespace)
}));
const getNotificationTemplate = (namespace = session) => getOrganization(namespace)
.then(organization => getOrCreate('/notification_templates/', {
.then(organization => getOrCreate(`/organizations/${organization.id}/notification_templates/`, {
name: `${namespace}-notification-template`,
description: namespace,
organization: organization.id,
@ -174,7 +174,7 @@ const getNotificationTemplate = (namespace = session) => getOrganization(namespa
}));
const getProject = (namespace = session) => getOrganization(namespace)
.then(organization => getOrCreate('/projects/', {
.then(organization => getOrCreate(`/organizations/${organization.id}/projects/`, {
name: `${namespace}-project`,
description: namespace,
organization: organization.id,
@ -246,10 +246,9 @@ const getJobTemplate = (namespace = session) => {
};
const getWorkflowTemplate = (namespace = session) => {
const endpoint = '/workflow_job_templates/';
const workflowTemplatePromise = getOrganization(namespace)
.then(organization => getOrCreate(endpoint, {
.then(organization => getOrCreate(`/organizations/${organization.id}/workflow_job_templates/`, {
name: `${namespace}-workflow-template`,
organization: organization.id,
variables: '---',
@ -288,7 +287,7 @@ const getWorkflowTemplate = (namespace = session) => {
};
const getAuditor = (namespace = session) => getOrganization(namespace)
.then(organization => getOrCreate('/users/', {
.then(organization => getOrCreate(`/organizations/${organization.id}/users/`, {
username: `auditor-${uuid().substr(0, 8)}`,
organization: organization.id,
first_name: 'auditor',
@ -300,7 +299,7 @@ const getAuditor = (namespace = session) => getOrganization(namespace)
}, ['username']));
const getUser = (namespace = session) => getOrganization(namespace)
.then(organization => getOrCreate('/users/', {
.then(organization => getOrCreate(`/organizations/${organization.id}/users/`, {
username: `user-${uuid().substr(0, 8)}`,
organization: organization.id,
first_name: 'firstname',
@ -316,7 +315,7 @@ const getJobTemplateAdmin = (namespace = session) => {
.then(obj => obj.summary_fields.object_roles.admin_role);
const userPromise = getOrganization(namespace)
.then(obj => getOrCreate('/users/', {
.then(obj => getOrCreate(`/organizations/${obj.id}/users/`, {
username: `job-template-admin-${uuid().substr(0, 8)}`,
organization: obj.id,
first_name: 'firstname',
@ -339,7 +338,7 @@ const getProjectAdmin = (namespace = session) => {
.then(obj => obj.summary_fields.object_roles.admin_role);
const userPromise = getOrganization(namespace)
.then(obj => getOrCreate('/users/', {
.then(obj => getOrCreate(`/organizations/${obj.id}/users/`, {
username: `project-admin-${uuid().substr(0, 8)}`,
organization: obj.id,
first_name: 'firstname',