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
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/tests/aws/requests/iam/login_profile_tests.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/tests/aws/requests/iam/login_profile_tests.rb
fog-1.0.0 tests/aws/requests/iam/login_profile_tests.rb