$:.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 branch_id = "test-branch-#{random_string}" branch_command = HelixWebServices::BranchCommand.new( branch: branch_id, view: [ "//depot/main/#{branch_id}/... //depot/dev/#{branch_id}/..." ] ) api.server_branches_post('localhost', branch_command) all_branches = api.server_branches_get('localhost') unless all_branches.any? { |b| b.branch == branch_id } raise "Did not locate branch #{branch_id}" end saved_branch = api.server_branches_branch_get('localhost', branch_id) raise 'view was not saved' if saved_branch.view != branch_command.view to_update = HelixWebServices::BranchCommand.new( description: "Update #{rand}" ) api.server_branches_branch_patch('localhost', branch_id, to_update) updated = api.server_branches_branch_get('localhost', branch_id) raise 'branch not updated' if updated.description.strip != to_update.description.strip api.server_branches_branch_delete('localhost', branch_id) all_branches2 = api.server_branches_get('localhost') if all_branches2.any? { |b| b.branch == branch_id } raise "Did not delete branch #{branch_id}" end