feat: refactor data source models and update mapping functions for improved consistency

This commit is contained in:
Andre_Harms 2026-02-09 21:28:49 +01:00
parent f0e7c19cdf
commit 184e133a2a
34 changed files with 980 additions and 1017 deletions

View file

@ -16,14 +16,14 @@ func TestMapDataSourceFields(t *testing.T) {
description string
input *sqlserverflexalpha.GetUserResponse
region string
expected DataSourceModel
expected dataSourceModel
isValid bool
}{
{
"default_values",
&sqlserverflexalpha.GetUserResponse{},
testRegion,
DataSourceModel{
dataSourceModel{
Id: types.StringValue("pid,region,iid,1"),
UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"),
@ -54,7 +54,7 @@ func TestMapDataSourceFields(t *testing.T) {
DefaultDatabase: utils.Ptr("default_db"),
},
testRegion,
DataSourceModel{
dataSourceModel{
Id: types.StringValue("pid,region,iid,1"),
UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"),
@ -85,7 +85,7 @@ func TestMapDataSourceFields(t *testing.T) {
Port: utils.Ptr(int64(2123456789)),
},
testRegion,
DataSourceModel{
dataSourceModel{
Id: types.StringValue("pid,region,iid,1"),
UserId: types.Int64Value(1),
InstanceId: types.StringValue("iid"),
@ -102,28 +102,28 @@ func TestMapDataSourceFields(t *testing.T) {
"nil_response",
nil,
testRegion,
DataSourceModel{},
dataSourceModel{},
false,
},
{
"nil_response_2",
&sqlserverflexalpha.GetUserResponse{},
testRegion,
DataSourceModel{},
dataSourceModel{},
false,
},
{
"no_resource_id",
&sqlserverflexalpha.GetUserResponse{},
testRegion,
DataSourceModel{},
dataSourceModel{},
false,
},
}
for _, tt := range tests {
t.Run(
tt.description, func(t *testing.T) {
state := &DataSourceModel{
state := &dataSourceModel{
ProjectId: tt.expected.ProjectId,
InstanceId: tt.expected.InstanceId,
UserId: tt.expected.UserId,