Skip to content

Commit

Permalink
Correct expectations from broken test, and add test to verify #924 is…
Browse files Browse the repository at this point in the history
… indeed fixed
  • Loading branch information
RomainMuller committed Oct 16, 2018
1 parent 769c28b commit 6bc44a0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
"Arn"
]
},
{
"Fn::GetAtt": [
"PipelineBucketB967BD35",
"Arn"
]
},
{
"Fn::Join": [
"",
Expand All @@ -57,22 +63,6 @@
"/*"
]
]
}
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:List*"
],
"Resource": [
{
"Fn::GetAtt": [
"PipelineBucketB967BD35",
"Arn"
]
},
{
"Fn::Join": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
"Arn"
]
},
{
"Fn::GetAtt": [
"PipelineBucketB967BD35",
"Arn"
]
},
{
"Fn::Join": [
"",
Expand All @@ -57,22 +63,6 @@
"/*"
]
]
}
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:List*"
],
"Resource": [
{
"Fn::GetAtt": [
"PipelineBucketB967BD35",
"Arn"
]
},
{
"Fn::Join": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,36 +118,6 @@
}
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucket*",
"s3:GetObject*",
"s3:List*"
],
"Resource": [
{
"Fn::GetAtt": [
"CodeDeployPipelineIntegTest9F618D61",
"Arn"
]
},
{
"Fn::Join": [
"",
[
{
"Fn::GetAtt": [
"CodeDeployPipelineIntegTest9F618D61",
"Arn"
]
},
"/*"
]
]
}
]
},
{
"Effect": "Allow",
"Action": [
Expand Down
16 changes: 16 additions & 0 deletions packages/@aws-cdk/aws-iam/test/test.policy-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ export = {
test.done();
},

'addAccountPrincipal can be used multiple times'(test: Test) {
const p = new PolicyStatement();
p.addAwsAccountPrincipal('1234');
p.addAwsAccountPrincipal('5678'),
test.deepEqual(resolve(p), {
Effect: 'Allow',
Principal: {
AWS: [
{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::1234:root']] },
{ 'Fn::Join': ['', ['arn:', { Ref: 'AWS::Partition' }, ':iam::5678:root']] }
]
}
});
test.done();
},

'hasResource': {
'false if there are no resources'(test: Test) {
test.equal(new PolicyStatement().hasResource, false, 'hasResource should be false for an empty permission');
Expand Down

0 comments on commit 6bc44a0

Please sign in to comment.