Skip to content

Commit

Permalink
Delete another_repo’s update job
Browse files Browse the repository at this point in the history
Use another_repo to test behavior of loading a project without an
update job. Delete the job after it finishes upon project creation.
  • Loading branch information
Glutexo committed May 24, 2018
1 parent d59d3ec commit d8a88b9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/tasks_private/spec_helper.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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']}
Expand All @@ -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

Expand Down

0 comments on commit d8a88b9

Please sign in to comment.