From 249dd7059e9c91712e459355126b0d4b57b25583 Mon Sep 17 00:00:00 2001 From: Tomoya Iwata Date: Sun, 28 Oct 2018 17:13:17 +0900 Subject: [PATCH] add test case for IoT attach_policy do nothing if policy have already attached to certificate --- tests/test_iot/test_iot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_iot/test_iot.py b/tests/test_iot/test_iot.py index 9082203d9..47ea9d59b 100644 --- a/tests/test_iot/test_iot.py +++ b/tests/test_iot/test_iot.py @@ -318,6 +318,15 @@ def test_principal_policy(): client.attach_policy(policyName=policy_name, target=cert_arn) + res = client.list_principal_policies(principal=cert_arn) + res.should.have.key('policies').which.should.have.length_of(1) + for policy in res['policies']: + policy.should.have.key('policyName').which.should_not.be.none + policy.should.have.key('policyArn').which.should_not.be.none + + # do nothing if policy have already attached to certificate + client.attach_policy(policyName=policy_name, target=cert_arn) + res = client.list_principal_policies(principal=cert_arn) res.should.have.key('policies').which.should.have.length_of(1) for policy in res['policies']: