Sha256: c0cd06abdb55a52e0dbadb43af22e8c6e9a1d3b5284a0f68d2d5078912322ad9

Contents?: true

Size: 1.59 KB

Versions: 4

Compression:

Stored size: 1.59 KB

Contents

describe 'ignore login profile' do
  let(:dsl) do
    <<-RUBY
      target /^iam-test-/

      user "iam-test-bob", :path=>"/devloper/" do
        login_profile :password_reset_required=>true

        policy "S3" do
          {"Statement"=>
            [{"Action"=>
               ["s3:Get*",
                "s3:List*"],
              "Effect"=>"Allow",
              "Resource"=>"*"}]}
        end
      end
    RUBY
  end

  let(:update_dsl) do
    <<-RUBY
      target /^iam-test-/

      user "iam-test-bob", :path=>"/devloper/" do
        login_profile :password_reset_required=>false

        policy "S3" do
          {"Statement"=>
            [{"Action"=>
               ["s3:Get*",
                "s3:List*",
                "s3:Put*"],
              "Effect"=>"Allow",
              "Resource"=>"*"}]}
        end
      end
    RUBY
  end

  let(:expected) do
    {:users=>
      {"iam-test-bob"=>
        {:path=>"/devloper/",
         :groups=>[],
         :policies=>
          {"S3"=>
            {"Statement"=>
              [{"Action"=>["s3:Get*", "s3:List*", "s3:Put*"],
                "Effect"=>"Allow",
                "Resource"=>"*"}]}},
         :attached_managed_policies=>[],
         :login_profile=>{:password_reset_required=>true}}},
     :groups=>{},
     :policies=>{},
     :roles=>{},
     :instance_profiles=>{}}
  end

  before(:each) do
    apply { dsl }
  end

  context 'when no change' do
    subject { client(ignore_login_profile: true) }

    it do
      updated = apply(subject) { update_dsl }
      expect(updated).to be_truthy
      expect(export).to eq expected
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
subiam-1.3.2 spec/subiam/ignore_login_profile_spec.rb
subiam-1.3.1 spec/subiam/ignore_login_profile_spec.rb
subiam-1.3.0 spec/subiam/ignore_login_profile_spec.rb
subiam-1.2.1 spec/subiam/ignore_login_profile_spec.rb