fix some issues with test matchby

main
Martin Guibert 2021-05-11 12:14:36 +02:00
parent ab026b66b8
commit 80fd17dae7
2 changed files with 10 additions and 10 deletions

View File

@ -836,13 +836,11 @@ func TestDriftctlRun_Middlewares(t *testing.T) {
},
},
mocks: func(factory resource.ResourceFactory) {
factory.(*terraform.MockResourceFactory).On("CreateAbstractResource", "foo", "aws_sns_topic_policy", mock.MatchedBy(func(input map[string]interface{}) bool {
return matchByAttributes(input, map[string]interface{}{
"id": "foo",
"arn": "arn",
"policy": "{\"policy\":\"bar\"}",
})
})).Times(1).Return(&resource.AbstractResource{
factory.(*terraform.MockResourceFactory).On("CreateAbstractResource", "foo", "aws_sns_topic_policy", map[string]interface{}{
"id": "foo",
"arn": "arn",
"policy": "{\"policy\":\"bar\"}",
}).Times(1).Return(&resource.AbstractResource{
Id: "foo",
Type: aws.AwsSnsTopicPolicyResourceType,
Attrs: &resource.Attributes{

View File

@ -57,9 +57,11 @@ func TestAwsSNSTopicPolicyExpander_Execute(t *testing.T) {
},
},
mock: func(factory *terraform.MockResourceFactory) {
factory.On("CreateAbstractResource", "ID", awsresource.AwsSnsTopicPolicyResourceType, mock.MatchedBy(func(input map[string]interface{}) bool {
return input["id"] == "ID"
})).Once().Return(&resource.AbstractResource{
factory.On("CreateAbstractResource", "ID", awsresource.AwsSnsTopicPolicyResourceType, map[string]interface{}{
"arn": "arn",
"id": "ID",
"policy": "{\"policy\":\"coucou\"}",
}).Once().Return(&resource.AbstractResource{
Id: "ID",
Type: awsresource.AwsSnsTopicPolicyResourceType,
Attrs: &resource.Attributes{