feat: add database_id attribute to resource model and update related functions
This commit is contained in:
parent
502b2f5e0a
commit
91913c3446
6 changed files with 90 additions and 65 deletions
|
|
@ -45,7 +45,8 @@ func TestMapFields(t *testing.T) {
|
|||
Name: types.StringValue("my-db"),
|
||||
Owner: types.StringValue("my-owner"),
|
||||
},
|
||||
Region: types.StringValue("eu01"),
|
||||
Region: types.StringValue("eu01"),
|
||||
DatabaseID: types.Int64Value(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -70,7 +71,8 @@ func TestMapFields(t *testing.T) {
|
|||
Name: types.StringValue("my-db"),
|
||||
Owner: types.StringNull(),
|
||||
},
|
||||
Region: types.StringValue("eu01"),
|
||||
DatabaseID: types.Int64Value(1),
|
||||
Region: types.StringValue("eu01"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -149,6 +151,7 @@ func TestMapResourceFields(t *testing.T) {
|
|||
Name: types.StringValue("my-db"),
|
||||
Owner: types.StringValue("my-owner"),
|
||||
},
|
||||
DatabaseID: types.Int64Value(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -233,38 +236,3 @@ func TestToCreatePayload(t *testing.T) {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCleanString(t *testing.T) {
|
||||
testcases := []struct {
|
||||
name string
|
||||
given *string
|
||||
expected *string
|
||||
}{
|
||||
{
|
||||
name: "should remove quotes",
|
||||
given: utils.Ptr("\"quoted\""),
|
||||
expected: utils.Ptr("quoted"),
|
||||
},
|
||||
{
|
||||
name: "should handle nil",
|
||||
given: nil,
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "should not change unquoted string",
|
||||
given: utils.Ptr("unquoted"),
|
||||
expected: utils.Ptr("unquoted"),
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testcases {
|
||||
t.Run(
|
||||
tc.name, func(t *testing.T) {
|
||||
actual := cleanString(tc.given)
|
||||
if diff := cmp.Diff(tc.expected, actual); diff != "" {
|
||||
t.Errorf("string mismatch (-want +got):\n%s", diff)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue