# coding: utf-8 from utils.test_config import * from utils.string_utils import * from helix_web_services_client.models import ClientCommand api = api_as_jdoe() rand = random_string() client_id = "test-client-%s" % rand client_command = ClientCommand() client_command.client = client_id client_command.host = None client_command.alt_roots = ['/alt/1', '/alt/2'] api.server_clients_post('localhost', client_command) all_clients = api.server_clients_get('localhost') assert any(b.client == client_id for b in all_clients), "did not find new client" saved_client = api.server_clients_client_get('localhost', client_id) assert saved_client.alt_roots == client_command.alt_roots, "Don't seem to have saved the client view" to_update = ClientCommand() to_update.description = "Update %s" % rand api.server_clients_client_patch('localhost', client_id, to_update) updated = api.server_clients_client_get('localhost', client_id) assert updated.description.strip() == to_update.description.strip(), "did not update description" api.server_clients_client_delete('localhost', client_id) all_clients2 = api.server_clients_get('localhost') assert any(b.client == client_id for b in all_clients2) == False, "did not delete new client"