diff --git a/libraries/aws_iam_password_policy.rb b/libraries/aws_iam_password_policy.rb index 83a40b780..3a93f0c2d 100644 --- a/libraries/aws_iam_password_policy.rb +++ b/libraries/aws_iam_password_policy.rb @@ -68,4 +68,8 @@ class AwsIamPasswordPolicy < Inspec.resource(1) unless prevents_password_reuse? @policy.password_reuse_prevention end + + def to_s + 'IAM Password-Policy' + end end diff --git a/test/unit/resources/aws_iam_password_policy_test.rb b/test/unit/resources/aws_iam_password_policy_test.rb index ddc3d1de3..ac4bbf0ea 100644 --- a/test/unit/resources/aws_iam_password_policy_test.rb +++ b/test/unit/resources/aws_iam_password_policy_test.rb @@ -66,6 +66,13 @@ class AwsIamPasswordPolicyTest < Minitest::Test assert_equal expectedValue, AwsIamPasswordPolicy.new(@mockConn).number_of_passwords_to_remember end + def test_policy_to_s + configure_policy_password_reuse_prevention(value: Object.new) + expectedValue = "IAM Password-Policy" + test = AwsIamPasswordPolicy.new(@mockConn).to_s + assert_equal expectedValue, test + end + private def configure_policy_password_reuse_prevention(value: value, n: 1)