$:.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_super rand = random_string server_id = "test-server-#{random_string}" server_command = HelixWebServices::ServerCommand.new( serverID: server_id, description: "test #{server_id}", type: 'server', services: 'standard' ) api.server_servers_post('localhost', server_command) all_servers = api.server_servers_get('localhost') unless all_servers.any? { |b| b.server_id == server_id } raise "Did not locate server #{server_id}" end saved_server = api.server_servers_server_id_get('localhost', server_id) raise 'server was not saved' if saved_server.description.strip != server_command.description.strip to_update = HelixWebServices::ServerCommand.new( description: "Update #{rand}" ) api.server_servers_server_id_patch('localhost', server_id, to_update) updated = api.server_servers_server_id_get('localhost', server_id) raise 'server not updated' if updated.description.strip != to_update.description.strip api.server_servers_server_id_delete('localhost', server_id) all_servers2 = api.server_servers_get('localhost') if all_servers2.any? { |b| b.server == server_id } raise "Did not delete server #{server_id}" end