mirror of
https://github.com/inspec/inspec
synced 2025-03-07 08:47:29 +00:00
Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com> wire up mock resource twice Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com> cleaning up as per pr feedback Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com> style fixes Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com> fix indent in test Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com> remove unneeded line Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com> use minitest mock instead of object Signed-off-by: Viktor Yakovlyev <Viktor.Y@D2L.com>
26 lines
No EOL
781 B
Ruby
26 lines
No EOL
781 B
Ruby
require 'helper'
|
|
require 'iam_password_policy'
|
|
require 'aws-sdk'
|
|
require 'json'
|
|
|
|
class IamPasswordPolicyTest < Minitest::Test
|
|
def setup
|
|
@mockConn = Minitest::Mock.new
|
|
end
|
|
|
|
def test_policy_exists_when_policy_exists
|
|
@mockResource = Minitest::Mock.new
|
|
@mockResource.expect :account_password_policy, true
|
|
@mockConn.expect :iam_resource, @mockResource
|
|
assert_equal true, IamPasswordPolicy.new(@mockConn).exists?
|
|
end
|
|
|
|
def test_policy_does_not_exists_when_no_policy
|
|
@mockResource = Minitest::Mock.new
|
|
@mockResource.expect :account_password_policy, nil do |args|
|
|
raise Aws::IAM::Errors::NoSuchEntity.new nil, nil
|
|
end
|
|
@mockConn.expect :iam_resource, @mockResource
|
|
assert_equal false, IamPasswordPolicy.new(@mockConn).exists?
|
|
end
|
|
end |