Sha256: 1a73d79e539fc0b2a8e9e404751cfe5fbd4c71145134e46920a4529cb2248e38

Contents?: true

Size: 1.42 KB

Versions: 100

Compression:

Stored size: 1.42 KB

Contents

Shindo.tests("Fog::Identity[:openstack] | ec2_credentials", ['openstack']) do
  before do
    openstack = Fog::Identity[:openstack]
    tenant_id = openstack.list_tenants.body['tenants'].first['id']

    @user = openstack.users.find { |user| user.name == 'foobar' }
    @user ||= openstack.users.create({
      :name      => 'foobar',
      :email     => 'foo@bar.com',
      :tenant_id => tenant_id,
      :password  => 'spoof',
      :enabled   => true
    })

    @ec2_credential = openstack.ec2_credentials.create({
      :user_id   => @user.id,
      :tenant_id => tenant_id,
    })
  end

  after do
    @user.ec2_credentials.each do |ec2_credential|
      ec2_credential.destroy
    end

    @user.destroy
  end

  tests('success') do
    tests('#find_by_access_key').succeeds do
      ec2_credential =
        @user.ec2_credentials.find_by_access_key(@ec2_credential.access)

      ec2_credential.access == @ec2_credential.access
    end

    tests('#create').succeeds do
      @user.ec2_credentials.create
    end

    tests('#destroy').succeeds do
      @user.ec2_credentials.destroy(@ec2_credential.access)
    end
  end

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

    tests('#find_by_access_key').raises(Fog::Identity::OpenStack::NotFound) do
      @user.ec2_credentials.find_by_access_key('fake')
    end

    tests('#destroy').raises(Fog::Identity::OpenStack::NotFound) do
      @user.ec2_credentials.destroy('fake')
    end
  end

end

Version data entries

100 entries across 100 versions & 10 rubygems

Version Path
fog-openstack-0.1.5 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-openstack-0.1.4 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-openstack-0.1.3 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-openstack-0.1.2 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-openstack-0.1.1 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-openstack-0.1.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.37.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.36.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.35.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-2.0.0.pre.0 tests/openstack/models/identity/ec2_credentials_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.34.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.33.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.32.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.31.0 tests/openstack/models/identity/ec2_credentials_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.30.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.29.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.28.0 tests/openstack/models/identity/ec2_credentials_tests.rb
fog-1.27.0 tests/openstack/models/identity/ec2_credentials_tests.rb