Skip to content

Commit

Permalink
Rename validateDestination to validateSubscriptionDestination
Browse files Browse the repository at this point in the history
Other name was to generic
  • Loading branch information
mvantellingen committed Jun 1, 2022
1 parent c6736c4 commit 737659b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions commercetools/resource_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func resourceSubscriptionCreate(ctx context.Context, d *schema.ResourceData, m i
client := getClient(m)
var subscription *platform.Subscription

if err := validateDestination(d); err != nil {
if err := validateSubscriptionDestination(d); err != nil {
return diag.FromErr(err)
}
if err := validateFormat(d); err != nil {
Expand Down Expand Up @@ -364,7 +364,7 @@ func resourceSubscriptionRead(ctx context.Context, d *schema.ResourceData, m int
func resourceSubscriptionUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
client := getClient(m)

if err := validateDestination(d); err != nil {
if err := validateSubscriptionDestination(d); err != nil {
return diag.FromErr(err)
}
if err := validateFormat(d); err != nil {
Expand Down Expand Up @@ -628,7 +628,7 @@ func unmarshallSubscriptionMessages(d *schema.ResourceData) []platform.MessageSu
return messageObjects
}

func validateDestination(d *schema.ResourceData) error {
func validateSubscriptionDestination(d *schema.ResourceData) error {
input := d.Get("destination").([]interface{})

if len(input) != 1 {
Expand Down
6 changes: 3 additions & 3 deletions commercetools/resource_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestValidateDestination(t *testing.T) {
func TestValidateSubscriptionDestination(t *testing.T) {
resource := resourceSubscription()
validDestinations := []map[string]interface{}{
{
Expand Down Expand Up @@ -47,7 +47,7 @@ func TestValidateDestination(t *testing.T) {
"destination": []interface{}{validDestination},
}
data := schema.TestResourceDataRaw(t, resource.Schema, rawData)
err := validateDestination(data)
err := validateSubscriptionDestination(data)
if err != nil {
t.Error("Expected no validation errors, but got ", err)
}
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestValidateDestination(t *testing.T) {
"destination": []interface{}{validDestination},
}
data := schema.TestResourceDataRaw(t, resource.Schema, rawData)
err := validateDestination(data)
err := validateSubscriptionDestination(data)
if err == nil {
t.Error("Expected validation errors, but none was reported")
}
Expand Down

0 comments on commit 737659b

Please sign in to comment.