Sha256: bece16a143c3063b8ee0010f536d4772e369248040aba8e90b0d9a2a8a3a58f1

Contents?: true

Size: 1.91 KB

Versions: 43

Compression:

Stored size: 1.91 KB

Contents

Shindo.tests("Fog::Compute[:iam] | roles", ['aws','iam']) do

  @iam = Fog::AWS[:iam]
  @role_one_name = 'fake_role_one'
  @role_two_name = 'fake_role_two'

  @role_three_name = 'fake_role_three'
  @role_three_path = '/path/to/fake_role_three/'
  @role_four_name  = 'fake_role_four'

  tests('#create').succeeds do
    @role_one = @iam.roles.create(:rolename => @role_one_name)
    @role_one.rolename == @role_one_name
  end

  tests('#all','there is only one role').succeeds do
    @iam.roles.size == 1
  end

  tests('#all','the only role should match').succeeds do
    @iam.roles.first.rolename == @role_one_name
  end

  tests('#create','a second role').succeeds do
    @role_two = @iam.roles.create(:rolename => @role_two_name)
    @role_two.rolename == @role_two_name
  end

  tests('#all','there are two roles').succeeds do
    @iam.roles.size == 2
  end

  tests('#get','an existing role').succeeds do
    @iam.roles.get(@role_one_name).rolename == @role_one_name
  end

  tests('#get',"returns nil if the role doesn't exists").succeeds do
    @iam.roles.get('blah').nil?
  end

  tests('#create', 'assigns path').succeeds do
    @role_three = @iam.roles.create(:rolename => @role_three_name, :path => @role_three_path)
    @role_three.path == @role_three_path
  end

  tests('#create', 'defaults path to /').succeeds do
    @role_four = @iam.roles.create(:rolename => @role_four_name)
    @role_four.path == '/'
  end

  tests('#destroy','an existing role').succeeds do
    @iam.roles.get(@role_one_name).destroy
  end

  tests('#all', 'limit 1').succeeds do
    1 == @iam.roles.all(:limit => 1).size
  end

  tests('#all', 'each_entry').succeeds do
    roles = []; @iam.roles.each(:limit => 1) { |r| roles << r }

    3 == roles.size
  end

  tests('#destroy','clean up remaining roles').succeeds do
    @iam.roles.get(@role_two_name).destroy
    @iam.roles.get(@role_three_name).destroy
    @iam.roles.get(@role_four_name).destroy
  end

end

Version data entries

43 entries across 41 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/tests/models/iam/roles_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/tests/models/iam/roles_tests.rb
fog-aws-3.0.0 tests/models/iam/roles_tests.rb
fog-aws-2.0.1 tests/models/iam/roles_tests.rb
fog-aws-2.0.0 tests/models/iam/roles_tests.rb
fog-aws-1.4.1 tests/models/iam/roles_tests.rb
fog-aws-1.4.0 tests/models/iam/roles_tests.rb
fog-aws-1.3.0 tests/models/iam/roles_tests.rb
fog-aws-1.2.1 tests/models/iam/roles_tests.rb
fog-aws-1.2.0 tests/models/iam/roles_tests.rb
fog-aws-1.1.0 tests/models/iam/roles_tests.rb
fog-aws-1.0.0 tests/models/iam/roles_tests.rb
fog-aws-0.13.0 tests/models/iam/roles_tests.rb
fog-aws-0.12.0 tests/models/iam/roles_tests.rb
fog-aws-0.11.0 tests/models/iam/roles_tests.rb
fog-aws-0.10.0 tests/models/iam/roles_tests.rb
fog-aws-0.9.4 tests/models/iam/roles_tests.rb
fog-aws-0.9.3 tests/models/iam/roles_tests.rb
fog-aws-0.9.2 tests/models/iam/roles_tests.rb
fog-aws-0.9.1 tests/models/iam/roles_tests.rb