Skip to content

Commit

Permalink
reactivated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
demeyerthom committed Sep 25, 2023
1 parent 68ded34 commit 45a0bc5
Showing 1 changed file with 91 additions and 88 deletions.
179 changes: 91 additions & 88 deletions internal/resources/project/model_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package project

import (
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/labd/terraform-provider-commercetools/internal/customtypes"
"github.com/labd/terraform-provider-commercetools/internal/utils"
"testing"

"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -64,94 +67,94 @@ func TestUpdateActions(t *testing.T) {
plan Project
action platform.ProjectUpdate
}{
//{
// name: "Default",
// state: Project{
// Version: types.Int64Value(1),
// ID: types.StringValue("my-project"),
// Key: types.StringValue("my-project"),
// Name: types.StringValue("my project"),
// Countries: []types.String{types.StringValue("US")},
// ShippingRateInputType: types.StringValue("CartValue"),
// },
// plan: Project{
// Version: types.Int64Value(1),
// ID: types.StringValue("my-project"),
// Key: types.StringValue("my-project"),
// Name: types.StringValue("my new name"),
// Countries: []types.String{
// types.StringValue("NL"),
// types.StringValue("DE"),
// },
// ShippingRateInputType: types.StringValue("CartClassification"),
// ShippingRateCartClassificationValue: []models.CustomFieldLocalizedEnumValue{
// {
// Key: types.StringValue("Light"),
// Label: customtypes.NewLocalizedStringValue(map[string]attr.Value{
// "nl": types.StringValue("licht"),
// "en": types.StringValue("light"),
// }),
// },
// },
// },
// action: platform.ProjectUpdate{
// Version: 1,
// Actions: []platform.ProjectUpdateAction{
// platform.ProjectChangeCountriesAction{
// Countries: []string{"NL", "DE"},
// },
// platform.ProjectChangeNameAction{
// Name: "my new name",
// },
// platform.ProjectSetShippingRateInputTypeAction{
// ShippingRateInputType: platform.CartClassificationType{
// Values: []platform.CustomFieldLocalizedEnumValue{
// {
// Key: "Light",
// Label: platform.LocalizedString{
// "en": "light",
// "nl": "licht",
// },
// },
// },
// },
// },
// },
// },
//},
//{
// name: "Carts Configuration",
// state: Project{
// Version: types.Int64Value(1),
// Carts: []Carts{
// {
// CountryTaxRateFallbackEnabled: types.BoolValue(true),
// DeleteDaysAfterLastModification: types.Int64Value(10),
// },
// },
// },
// plan: Project{
// Version: types.Int64Value(1),
// Carts: []Carts{
// {
// CountryTaxRateFallbackEnabled: types.BoolValue(false),
// DeleteDaysAfterLastModification: types.Int64Value(90),
// },
// },
// },
// action: platform.ProjectUpdate{
// Version: 1,
// Actions: []platform.ProjectUpdateAction{
// platform.ProjectChangeCartsConfigurationAction{
// CartsConfiguration: platform.CartsConfiguration{
// CountryTaxRateFallbackEnabled: utils.BoolRef(false),
// DeleteDaysAfterLastModification: utils.IntRef(90),
// },
// },
// platform.ProjectChangeCountryTaxRateFallbackEnabledAction{CountryTaxRateFallbackEnabled: false},
// },
// },
//},
{
name: "Default",
state: Project{
Version: types.Int64Value(1),
ID: types.StringValue("my-project"),
Key: types.StringValue("my-project"),
Name: types.StringValue("my project"),
Countries: []types.String{types.StringValue("US")},
ShippingRateInputType: types.StringValue("CartValue"),
},
plan: Project{
Version: types.Int64Value(1),
ID: types.StringValue("my-project"),
Key: types.StringValue("my-project"),
Name: types.StringValue("my new name"),
Countries: []types.String{
types.StringValue("NL"),
types.StringValue("DE"),
},
ShippingRateInputType: types.StringValue("CartClassification"),
ShippingRateCartClassificationValue: []models.CustomFieldLocalizedEnumValue{
{
Key: types.StringValue("Light"),
Label: customtypes.NewLocalizedStringValue(map[string]attr.Value{
"nl": types.StringValue("licht"),
"en": types.StringValue("light"),
}),
},
},
},
action: platform.ProjectUpdate{
Version: 1,
Actions: []platform.ProjectUpdateAction{
platform.ProjectChangeCountriesAction{
Countries: []string{"NL", "DE"},
},
platform.ProjectChangeNameAction{
Name: "my new name",
},
platform.ProjectSetShippingRateInputTypeAction{
ShippingRateInputType: platform.CartClassificationType{
Values: []platform.CustomFieldLocalizedEnumValue{
{
Key: "Light",
Label: platform.LocalizedString{
"en": "light",
"nl": "licht",
},
},
},
},
},
},
},
},
{
name: "Carts Configuration",
state: Project{
Version: types.Int64Value(1),
Carts: []Carts{
{
CountryTaxRateFallbackEnabled: types.BoolValue(true),
DeleteDaysAfterLastModification: types.Int64Value(10),
},
},
},
plan: Project{
Version: types.Int64Value(1),
Carts: []Carts{
{
CountryTaxRateFallbackEnabled: types.BoolValue(false),
DeleteDaysAfterLastModification: types.Int64Value(90),
},
},
},
action: platform.ProjectUpdate{
Version: 1,
Actions: []platform.ProjectUpdateAction{
platform.ProjectChangeCartsConfigurationAction{
CartsConfiguration: platform.CartsConfiguration{
CountryTaxRateFallbackEnabled: utils.BoolRef(false),
DeleteDaysAfterLastModification: utils.IntRef(90),
},
},
platform.ProjectChangeCountryTaxRateFallbackEnabledAction{CountryTaxRateFallbackEnabled: false},
},
},
},
{
name: "Create with bool unknown",
state: Project{
Expand Down

0 comments on commit 45a0bc5

Please sign in to comment.