# coding: utf-8 from utils.test_config import * from utils.string_utils import * from helix_web_services_client.models import BranchCommand api = api_as_jdoe() rand = random_string() branch_id = "test-branch-%s" % rand branch_command = BranchCommand() branch_command.branch = branch_id branch_command.view = [ "//depot/main/%s/... //depot/dev/%s/..." % (branch_id, branch_id) ] api.server_branches_post('localhost', branch_command) all_branches = api.server_branches_get('localhost') assert any(b.branch == branch_id for b in all_branches), "did not find new branch" saved_branch = api.server_branches_branch_get('localhost', branch_id) assert saved_branch.view == branch_command.view, "Don't seem to have saved the branch view" to_update = BranchCommand() to_update.description = "Update %s" % rand api.server_branches_branch_patch('localhost', branch_id, to_update) updated = api.server_branches_branch_get('localhost', branch_id) assert updated.description.strip() == to_update.description.strip(), "did not update description" api.server_branches_branch_delete('localhost', branch_id) all_branches2 = api.server_branches_get('localhost') assert any(b.branch == branch_id for b in all_branches2) == False, "did not delete new branch"