From 5da13683cec11630a998ce61eda91277d0f83bd8 Mon Sep 17 00:00:00 2001 From: Daniel Sami Date: Wed, 31 Oct 2018 11:03:44 -0400 Subject: [PATCH 1/2] updated fixtures to use proper organization linking --- awx/ui/test/e2e/fixtures.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/awx/ui/test/e2e/fixtures.js b/awx/ui/test/e2e/fixtures.js index c3e069ac5e..a253bdd59f 100644 --- a/awx/ui/test/e2e/fixtures.js +++ b/awx/ui/test/e2e/fixtures.js @@ -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', From e152b30fc15b246b6313719f6bd4be53c9c708d5 Mon Sep 17 00:00:00 2001 From: Daniel Sami Date: Wed, 31 Oct 2018 11:22:31 -0400 Subject: [PATCH 2/2] linting fixes --- awx/ui/test/e2e/fixtures.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/awx/ui/test/e2e/fixtures.js b/awx/ui/test/e2e/fixtures.js index a253bdd59f..f88ced43bb 100644 --- a/awx/ui/test/e2e/fixtures.js +++ b/awx/ui/test/e2e/fixtures.js @@ -153,7 +153,7 @@ const getTeam = (namespace = session) => getOrganization(namespace) })); const getSmartInventory = (namespace = session) => getOrganization(namespace) - .then(organization => getOrCreate(`/inventories/`, { + .then(organization => getOrCreate('/inventories/', { name: `${namespace}-smart-inventory`, description: namespace, organization: organization.id, @@ -218,15 +218,6 @@ const getUpdatedProject = (namespace = session) => getProject(namespace) return project; }); -const getJob = (namespace = session) => getJobTemplate(namespace) - .then(template => { - const launchURL = template.related.launch; - return post(launchURL, {}).then(response => { - const jobURL = response.data.url; - return waitForJob(jobURL).then(() => response.data); - }); - }); - const getJobTemplate = (namespace = session) => { const promises = [ getInventory(namespace), @@ -245,8 +236,16 @@ const getJobTemplate = (namespace = session) => { })); }; -const getWorkflowTemplate = (namespace = session) => { +const getJob = (namespace = session) => getJobTemplate(namespace) + .then(template => { + const launchURL = template.related.launch; + return post(launchURL, {}).then(response => { + const jobURL = response.data.url; + return waitForJob(jobURL).then(() => response.data); + }); + }); +const getWorkflowTemplate = (namespace = session) => { const workflowTemplatePromise = getOrganization(namespace) .then(organization => getOrCreate(`/organizations/${organization.id}/workflow_job_templates/`, { name: `${namespace}-workflow-template`,