# coding: utf-8 from utils.test_config import * from utils.string_utils import * from helix_web_services_client.models import ServerCommand api = api_as_super() rand = random_string() server_id = "test-server-%s" % rand server_command = ServerCommand() server_command.server_id = server_id server_command.description = "test %s" % server_id server_command.type = 'server' server_command.services = 'standard' api.server_servers_post('localhost', server_command) all_servers = api.server_servers_get('localhost') assert any(b.server_id == server_id for b in all_servers), "did not find new server" saved_server = api.server_servers_server_id_get('localhost', server_id) assert saved_server.description.strip() == server_command.description.strip(), "Don't seem to have saved the server view" to_update = ServerCommand() to_update.description = "Update %s" % rand api.server_servers_server_id_patch('localhost', server_id, to_update) updated = api.server_servers_server_id_get('localhost', server_id) assert updated.description.strip() == to_update.description.strip(), "did not update description" api.server_servers_server_id_delete('localhost', server_id) all_servers2 = api.server_servers_get('localhost') assert any(b.server_id == server_id for b in all_servers2) == False, "did not delete new server"