Sha256: 223893cc00a7827f556e1bcbd0bd7ab5d9422af6875a80b11b1026dd84c9c0d9

Contents?: true

Size: 687 Bytes

Versions: 12

Compression:

Stored size: 687 Bytes

Contents

require 'test_helper'
require 'json'

class TestTrust < Minitest::Test
  def setup
    @template = ::Convection.template do
      description 'Trust Test Template'

      iam_role 'FooRole' do
        trust_service 'bar'
      end
    end
  end

  def from_json
    JSON.parse(@template.to_json)
  end

  def test_trust
    json = from_json['Resources']['FooRole']['Properties']
    doc = json['AssumeRolePolicyDocument']
    refute doc.nil?, 'No policy document present in JSON'
    stmt = doc['Statement']

    trust_bar = stmt.any? { |s| s['Principal']['Service'] == 'bar.amazonaws.com' }
    assert_equal true, trust_bar, 'Expected to find [bar.amazonaws.com] in document'
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
convection-0.2.32 test/convection/model/test_trust.rb
convection-0.2.31 test/convection/model/test_trust.rb
convection-0.2.30 test/convection/model/test_trust.rb
convection-0.2.29 test/convection/model/test_trust.rb
convection-0.2.28 test/convection/model/test_trust.rb
convection-0.2.27 test/convection/model/test_trust.rb
convection-0.2.26 test/convection/model/test_trust.rb
convection-0.2.25 test/convection/model/test_trust.rb
convection-0.2.24 test/convection/model/test_trust.rb
convection-0.2.23 test/convection/model/test_trust.rb
convection-0.2.22 test/convection/model/test_trust.rb
convection-0.2.21 test/convection/model/test_trust.rb