Sha256: 85001327692e54165546d109800cc8706f3faa23e98246d1abb50aaf73831f13

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

Shindo.tests("Fog::Compute[:openstack] | tenants", ['openstack']) do
  openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
  @instance = openstack.tenants.create(:name => 'test')

  tests('success') do
    tests('#find_by_id').succeeds do
      openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
      tenant = openstack.tenants.find_by_id(@instance.id)
      tenant.id == @instance.id
    end

    tests('#destroy').succeeds do
      openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
      openstack.tenants.destroy(@instance.id)
    end
  end

  tests('fails') do
    pending if Fog.mocking?

    tests('#find_by_id').raises(Fog::Identity::OpenStack::NotFound) do
      openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
      openstack.tenants.find_by_id('fake')
    end

    tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do
      openstack = Fog::Identity::OpenStack.new(:openstack_auth_url => 'http://openstack:35357/v2.0/tokens')
      openstack.tenants.destroy('fake')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-openstack-0.1.6 tests/openstack/models/identity/tenants_tests.rb