From d8a88b9ec6dbcbb0447f4d8b1271a2cd5ff3ff3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Tomsa?= Date: Wed, 9 May 2018 14:22:09 +0200 Subject: [PATCH] =?UTF-8?q?Delete=20another=5Frepo=E2=80=99s=20update=20jo?= =?UTF-8?q?b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use another_repo to test behavior of loading a project without an update job. Delete the job after it finishes upon project creation. --- lib/tasks_private/spec_helper.rake | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/tasks_private/spec_helper.rake b/lib/tasks_private/spec_helper.rake index e2f54023..48f1fbbd 100644 --- a/lib/tasks_private/spec_helper.rake +++ b/lib/tasks_private/spec_helper.rake @@ -179,11 +179,6 @@ class PopulateTower data = {"name" => 'hello_repo', "scm_url" => "https://github.com/jameswnl/ansible-examples", "scm_type" => "git", "credential" => scm_credential['id'], "organization" => organization['id']} project = create_obj(uri, data) - # create another project - uri = '/api/v1/projects/' - data = {"name" => 'another_repo', "scm_url" => "https://github.com/jameswnl/ansible-examples", "scm_type" => "git", "credential" => scm_credential['id'], "organization" => organization['id']} - create_obj(uri, data) - # create a job_template uri = '/api/v1/job_templates/' data = {"name" => 'hello_template', "description" => "test job", "job_type" => "run", "project" => project['id'], "playbook" => "hello_world.yml", "credential" => machine_credential['id'], "cloud_credential" => aws_credential['id'], "network_credential" => network_credential['id'], "inventory" => inventory['id'], "organization" => organization['id']} @@ -198,6 +193,15 @@ class PopulateTower data = {"name" => "Simple Survey", "description" => "Description of the simple survey", "spec" => [{"type" => "text", "question_name" => "example question", "question_description" => "What is your favorite color?", "variable" => "favorite_color", "required" => false, "default" => "blue"}]} @conn.post(uri, data).body puts "created #{template['url']} survey_spec" + + # create another project + uri = '/api/v1/projects/' + data = {"name" => 'another_repo', "scm_url" => "https://github.com/jameswnl/ansible-examples", "scm_type" => "git", "credential" => scm_credential['id'], "organization" => organization['id']} + another_project = create_obj(uri, data) + + uri = JSON.parse(@conn.get(another_project['url'], data).body)['related']['last_update'] + @conn.delete(uri) + self end