Sha256: 0d83bfe91b62c5af0d1927d3d1220e5c1bddb7cee7f902763e9e3e21de2ef511

Contents?: true

Size: 1.89 KB

Versions: 103

Compression:

Stored size: 1.89 KB

Contents

Shindo.tests('AWS::IAM | user requests', ['aws']) do

  unless Fog.mocking?
    Fog::AWS[:iam].create_user('fog_user')
  end


  tests('success') do
    @login_profile_format = {
      'LoginProfile' => {
        'UserName'  => String,
        'CreateDate'  => Time
        
      },
      'RequestId' => String
    }
    
    tests("#create_login_profile('fog_user')").formats(@login_profile_format) do
      pending if Fog.mocking?
      Fog::AWS[:iam].create_login_profile('fog_user', 'somepassword').body
    end

    tests("#get_login_profile('fog_user')").formats(@login_profile_format) do
      pending if Fog.mocking?
      result = Fog::AWS[:iam].get_login_profile('fog_user').body
      returns('fog_user') {result['LoginProfile']['UserName']}
      result
    end

    tests("#update_login_profile('fog_user')").formats(AWS::IAM::Formats::BASIC) do
      pending if Fog.mocking?
      begin
        Fog::AWS[:iam].update_login_profile('fog_user', 'otherpassword').body
      rescue Excon::Errors::Conflict #profile cannot be updated or deleted until it has finished creating; api provides no way of telling whether creation process complete
        sleep 5
        retry
      end
    end

    tests("#delete_login_profile('fog_user')").formats(AWS::IAM::Formats::BASIC) do
      pending if Fog.mocking?
      Fog::AWS[:iam].delete_login_profile('fog_user').body
    end

    tests("#get_login_profile('fog_user')") do
      pending if Fog.mocking?
      raises(Excon::Errors::NotFound) {Fog::AWS[:iam].get_login_profile('fog_user')}
    end

  end

  tests('failure') do
    tests('get login profile for non existing user') do
      pending if Fog.mocking?
      raises(Fog::AWS::IAM::NotFound) { Fog::AWS[:iam].get_login_profile('idontexist')}
      raises(Fog::AWS::IAM::NotFound) { Fog::AWS[:iam].delete_login_profile('fog_user')}
    end
  end


  unless Fog.mocking?
    Fog::AWS[:iam].delete_user('fog_user')
  end
end

Version data entries

103 entries across 103 versions & 17 rubygems

Version Path
fog-1.22.0 tests/aws/requests/iam/login_profile_tests.rb
fog-1.21.0 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.20.0.20140305101839 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.20.0.20140305101305 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/aws/requests/iam/login_profile_tests.rb
fog-1.20.0 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/aws/requests/iam/login_profile_tests.rb
fog-1.19.0 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/aws/requests/iam/login_profile_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/aws/requests/iam/login_profile_tests.rb