Sha256: c860c86c51cb8df8d7a707b831351d6b7280e9b985c42c70d62cb2b3556ec865

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 KB

Contents

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

  @tenant_format = {
    'id'   => String,
    'name' => String,
    'enabled'     => Fog::Nullable::Boolean,
    'description' => Fog::Nullable::String,
    'extra' => Fog::Nullable::Hash
  }

  @role_format = {
    'id'   => String,
    'name' => String
  }

  tests('success') do
    tests('#list_tenants').formats({'tenants' => [@tenant_format], 'tenants_links' => []}) do
      Fog::Identity[:openstack].list_tenants.body
    end

    tests('#list_roles_for_user_on_tenant(0,1)').
      formats({'roles' => [@role_format]}) do
      user = Fog::Identity[:openstack].create_user("testuser", "passw", "e@mail.co", "us3r1d").body['user']

      openstack = Fog::Identity[:openstack]
      openstack.list_roles_for_user_on_tenant(
        openstack.current_tenant['id'], user['id']).body
    end

    tests('#create_tenant').formats({'tenant' => @tenant_format}) do
      @instance = Fog::Identity[:openstack].create_tenant('name' => 'test').body
    end

    tests('#get_tenant').formats({'tenant' => @tenant_format}) do
      Fog::Identity[:openstack].get_tenant(@instance['tenant']['id']).body
    end

    tests('#update_tenant check format').formats({'tenant' => @tenant_format}) do
      @instance = Fog::Identity[:openstack].update_tenant(
        @instance['tenant']['id'], 'name' => 'test2').body
    end

    tests('#update_tenant update name').succeeds do
      @instance = Fog::Identity[:openstack].update_tenant(
        @instance['tenant']['id'], 'name' => 'test3').body
      @instance['tenant']['name'] == 'test3'
    end

    tests('#delete_tenant').succeeds do
      Fog::Identity[:openstack].delete_tenant(@instance['tenant']['id'])
    end

  end
end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
fog-nirvanix-1.8.2 tests/openstack/requests/identity/tenant_tests.rb
fog-nirvanix-1.8.1 tests/openstack/requests/identity/tenant_tests.rb
fog-1.9.0 tests/openstack/requests/identity/tenant_tests.rb
fog-maestrodev-1.8.0.20130114204828 tests/openstack/requests/identity/tenant_tests.rb
fog-maestrodev-1.8.0.20130111070250 tests/openstack/requests/identity/tenant_tests.rb
fog-maestrodev-1.8.0.20130109172219 tests/openstack/requests/identity/tenant_tests.rb
fog-sgonyea-1.8.1 tests/openstack/requests/identity/tenant_tests.rb
fog-1.8.0 tests/openstack/requests/identity/tenant_tests.rb
fog-maestrodev-1.7.0.20121114190951 tests/openstack/requests/identity/tenant_tests.rb
fog-1.7.0 tests/openstack/requests/identity/tenant_tests.rb