# coding: utf-8 from utils.test_config import * from utils.string_utils import * from helix_web_services_client.models import LabelCommand api = api_as_jdoe() rand = random_string() label_id = "test-label-%s" % rand label_command = LabelCommand() label_command.label = label_id label_command.description = label_id label_command.view = [ "//depot/main/%s/..." % (label_id) ] api.server_labels_post('localhost', label_command) all_labels = api.server_labels_get('localhost') assert any(b.label == label_id for b in all_labels), "did not find new label" saved_label = api.server_labels_label_get('localhost', label_id) assert saved_label.view == label_command.view, "Don't seem to have saved the label view" to_update = LabelCommand() to_update.description = "Update %s" % rand api.server_labels_label_patch('localhost', label_id, to_update) updated = api.server_labels_label_get('localhost', label_id) assert updated.description.strip() == to_update.description.strip(), "did not update description" api.server_labels_label_delete('localhost', label_id) all_labels2 = api.server_labels_get('localhost') assert any(b.label == label_id for b in all_labels2) == False, "did not delete new label"