$:.push File.expand_path("../../lib", __FILE__) require 'helix_web_services_client' require_relative './util/test_config' require_relative './util/string_utils' require 'pp' api = api_as_jdoe rand = random_string job_id = "test-job-#{random_string}" job_command = HelixWebServices::JobCommand.new( Job: job_id, User: 'jdoe', Description: "test #{job_id}", Status: 'open' ) api.server_jobs_post('localhost', job_command) all_jobs = api.server_jobs_get('localhost') unless all_jobs.any? { |b| b.Job == job_id } raise "Did not locate job #{job_id}" end saved_job = api.server_jobs_job_get('localhost', job_id) raise 'job was not saved' if saved_job.Description.strip != job_command.Description.strip to_update = HelixWebServices::JobCommand.new( Status: 'closed' ) api.server_jobs_job_patch('localhost', job_id, to_update) updated = api.server_jobs_job_get('localhost', job_id) raise 'job not updated' if updated.Status != 'closed' api.server_jobs_job_delete('localhost', job_id) all_jobs2 = api.server_jobs_get('localhost') if all_jobs2.any? { |b| b.Job == job_id } raise "Did not delete job #{job_id}" end