Fixed policy version's Document type for AWS managed policies (#2234)

* Added checking Document's type in AWS managed policy version response.

* Fixed policy version's Document type for AWS managed policies.
This commit is contained in:
Bendegúz Ács 2019-06-10 21:00:37 +02:00 committed by Terry Cain
parent 3833449b36
commit ab8a189bbf
2 changed files with 3 additions and 1 deletions

View File

@ -131,7 +131,7 @@ class AWSManagedPolicy(ManagedPolicy):
return cls(name,
default_version_id=data.get('DefaultVersionId'),
path=data.get('Path'),
document=data.get('Document'),
document=json.dumps(data.get('Document')),
create_date=datetime.strptime(data.get('CreateDate'), "%Y-%m-%dT%H:%M:%S+00:00"),
update_date=datetime.strptime(data.get('UpdateDate'), "%Y-%m-%dT%H:%M:%S+00:00"))

View File

@ -369,6 +369,7 @@ def test_get_aws_managed_policy_version():
PolicyArn=managed_policy_arn,
VersionId="v1")
retrieved['PolicyVersion']['CreateDate'].replace(tzinfo=None).should.equal(managed_policy_version_create_date)
retrieved['PolicyVersion']['Document'].should.be.an(dict)
@mock_iam
@ -384,6 +385,7 @@ def test_get_aws_managed_policy_v4_version():
PolicyArn=managed_policy_arn,
VersionId="v4")
retrieved['PolicyVersion']['CreateDate'].replace(tzinfo=None).should.equal(managed_policy_version_create_date)
retrieved['PolicyVersion']['Document'].should.be.an(dict)
@mock_iam