$:.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 group_id = "test-group-#{random_string}" group_command = HelixWebServices::GroupCommand.new( group: group_id, users: ['jdoe'], owners: ['jdoe'] ) api.server_groups_post('localhost', group_command) all_groups = api.server_groups_get('localhost') unless all_groups.any? { |b| b.group == group_id } raise "Did not locate group #{group_id}" end saved_group = api.server_groups_group_get('localhost', group_id) unless saved_group.users == group_command.users raise 'users were not saved correctly' end unless saved_group.owners == group_command.owners raise 'owners were not saved correctly' end to_update = HelixWebServices::GroupCommand.new( users: ['mmustermann'] ) api.server_groups_group_patch('localhost', group_id, to_update) updated = api.server_groups_group_get('localhost', group_id) unless updated.users.any? { |u| u == 'mmustermann'} raise 'Group was not updated' end api.server_groups_group_delete('localhost', group_id) all_groups2 = api.server_groups_get('localhost') if all_groups2.any? { |b| b.group == group_id } raise "Did not delete group #{group_id}" end