Sha256: 2afbf2c11435aec86ad9e8f900c77a96070e96c00f5613ff6b8e81807bfc8bf5

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

Shindo.tests('Fog::Identity[:openstack] | user requests', ['openstack']) do

  @user_format = {
    'id'   => String,
    'name' => String,
    'enabled'  => Fog::Boolean,
    'email'    => String,
    'tenantId' => Fog::Nullable::String
  }

  @identity = Fog::Identity[:openstack]

  tests('success') do

    @user_name = Fog::Mock.random_hex(64)
    @user_name_update = Fog::Mock.random_hex(64)

    tests("#create_user('#{@user_name}', 'mypassword', 'morph@example.com', 't3n4nt1d', true)").formats(@user_format, false) do
      @user = @identity.create_user(
        @user_name, "mypassword", "morph@example.com",
        OpenStack::Identity.get_tenant_id
      ).body['user']
    end

    tests('#list_users').formats({'users' => [@user_format]}) do
      @identity.list_users.body
    end

    tests('#get_user_by_id').formats(@user_format) do
      @identity.get_user_by_id(@user['id']).body['user']
    end

    tests('#get_user_by_name').formats(@user_format) do
      @identity.get_user_by_name(@user['name']).body['user']
    end

    tests("#update_user(#{@user['id']}, :name => 'fogupdateduser')").succeeds do
      @identity.update_user(@user['id'], :name => @user_name_update, :email => 'fog@test.com')
    end

    tests("#delete_user(#{@user['id']})").succeeds do
      @identity.delete_user(@user['id'])
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-openstack-0.1.6 tests/openstack/requests/identity/user_tests.rb