Skip to content

Commit

Permalink
Refacto s3 bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
Elie committed Apr 29, 2021
1 parent 4a23882 commit d4d1613
Show file tree
Hide file tree
Showing 12 changed files with 818 additions and 707 deletions.
23 changes: 12 additions & 11 deletions pkg/driftctl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,13 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
{
name: "test bucket policy expander middleware",
stateResources: []resource.Resource{
&aws.AwsS3Bucket{
Id: "foo",
Bucket: awssdk.String("foo"),
Policy: awssdk.String("{\"Id\":\"foo\"}"),
&resource.AbstractResource{
Id: "foo",
Type: aws.AwsS3BucketResourceType,
Attrs: &resource.Attributes{
"bucket": "foo",
"policy": "{\"Id\":\"foo\"}",
},
},
},
remoteResources: []resource.Resource{
Expand All @@ -354,13 +357,11 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
"bucket": cty.StringVal("foo"),
"policy": cty.StringVal("{\"Id\":\"foo\"}"),
})
factory.(*terraform.MockResourceFactory).On("CreateResource", mock.MatchedBy(func(input map[string]interface{}) bool {
return matchByAttributes(input, map[string]interface{}{
"id": "foo",
"bucket": awssdk.String("foo"),
"policy": awssdk.String("{\"Id\":\"foo\"}"),
})
}), "aws_s3_bucket_policy").Times(1).Return(&foo, nil)
factory.(*terraform.MockResourceFactory).On("CreateResource", map[string]interface{}{
"id": "foo",
"bucket": "foo",
"policy": "{\"Id\":\"foo\"}",
}, "aws_s3_bucket_policy").Times(1).Return(&foo, nil)
},
filter: "Type=='aws_s3_bucket_policy' && Attr.bucket=='foo'",
assert: func(result *test.ScanResult, err error) {
Expand Down
Loading

0 comments on commit d4d1613

Please sign in to comment.