@@ -16,7 +16,8 @@ import (
16
16
)
17
17
18
18
func TestMapFolderFields (t * testing.T ) {
19
- testUUID := "73b2d741-bddd-471f-8d47-3d1aa677a19c"
19
+ parentContainerUUID := uuid .New ().String ()
20
+ folderUUID := uuid .New ().String ()
20
21
21
22
// Create base timestamps for reuse
22
23
baseTime := time .Now ()
@@ -26,6 +27,7 @@ func TestMapFolderFields(t *testing.T) {
26
27
tests := []struct {
27
28
description string
28
29
uuidContainerParentId bool
30
+ respFolderId * string
29
31
respContainerId * string
30
32
respName * string
31
33
respCreateTime * time.Time
@@ -39,6 +41,7 @@ func TestMapFolderFields(t *testing.T) {
39
41
{
40
42
description : "valid input with UUID parent ID" ,
41
43
uuidContainerParentId : true ,
44
+ respFolderId : & folderUUID ,
42
45
respContainerId : utils .Ptr ("folder-cid-uuid" ),
43
46
respName : utils .Ptr ("folder-name" ),
44
47
respCreateTime : & createTime ,
@@ -47,12 +50,13 @@ func TestMapFolderFields(t *testing.T) {
47
50
"env" : "prod" ,
48
51
},
49
52
parent : & resourcemanager.Parent {
50
- Id : utils .Ptr (testUUID ),
53
+ Id : utils .Ptr (parentContainerUUID ),
51
54
},
52
55
expected : Model {
53
56
Id : types .StringValue ("folder-cid-uuid" ),
57
+ FolderId : types .StringValue (folderUUID ),
54
58
ContainerId : types .StringValue ("folder-cid-uuid" ),
55
- ContainerParentId : types .StringValue (testUUID ),
59
+ ContainerParentId : types .StringValue (parentContainerUUID ),
56
60
Name : types .StringValue ("folder-name" ),
57
61
CreationTime : types .StringValue (createTime .Format (time .RFC3339 )),
58
62
UpdateTime : types .StringValue (updateTime .Format (time .RFC3339 )),
@@ -65,18 +69,20 @@ func TestMapFolderFields(t *testing.T) {
65
69
{
66
70
description : "valid input with UUID parent ID no labels" ,
67
71
uuidContainerParentId : true ,
72
+ respFolderId : & folderUUID ,
68
73
respContainerId : utils .Ptr ("folder-cid-uuid" ),
69
74
respName : utils .Ptr ("folder-name" ),
70
75
respCreateTime : & createTime ,
71
76
respUpdateTime : & updateTime ,
72
77
labels : nil ,
73
78
parent : & resourcemanager.Parent {
74
- Id : utils .Ptr (testUUID ),
79
+ Id : utils .Ptr (parentContainerUUID ),
75
80
},
76
81
expected : Model {
77
82
Id : types .StringValue ("folder-cid-uuid" ),
83
+ FolderId : types .StringValue (folderUUID ),
78
84
ContainerId : types .StringValue ("folder-cid-uuid" ),
79
- ContainerParentId : types .StringValue (testUUID ),
85
+ ContainerParentId : types .StringValue (parentContainerUUID ),
80
86
Name : types .StringValue ("folder-name" ),
81
87
CreationTime : types .StringValue (createTime .Format (time .RFC3339 )),
82
88
UpdateTime : types .StringValue (updateTime .Format (time .RFC3339 )),
@@ -87,6 +93,7 @@ func TestMapFolderFields(t *testing.T) {
87
93
{
88
94
description : "valid input with ContainerId as parent" ,
89
95
uuidContainerParentId : false ,
96
+ respFolderId : & folderUUID ,
90
97
respContainerId : utils .Ptr ("folder-cid" ),
91
98
respName : utils .Ptr ("folder-name" ),
92
99
respCreateTime : & createTime ,
@@ -99,6 +106,7 @@ func TestMapFolderFields(t *testing.T) {
99
106
},
100
107
expected : Model {
101
108
Id : types .StringValue ("folder-cid" ),
109
+ FolderId : types .StringValue (folderUUID ),
102
110
ContainerId : types .StringValue ("folder-cid" ),
103
111
ContainerParentId : types .StringValue ("parent-container-id" ),
104
112
Name : types .StringValue ("folder-name" ),
@@ -113,6 +121,7 @@ func TestMapFolderFields(t *testing.T) {
113
121
{
114
122
description : "valid input with ContainerId as parent no labels" ,
115
123
uuidContainerParentId : false ,
124
+ respFolderId : & folderUUID ,
116
125
respContainerId : utils .Ptr ("folder-cid" ),
117
126
respName : utils .Ptr ("folder-name" ),
118
127
respCreateTime : & createTime ,
@@ -123,6 +132,7 @@ func TestMapFolderFields(t *testing.T) {
123
132
},
124
133
expected : Model {
125
134
Id : types .StringValue ("folder-cid" ),
135
+ FolderId : types .StringValue (folderUUID ),
126
136
ContainerId : types .StringValue ("folder-cid" ),
127
137
ContainerParentId : types .StringValue ("parent-container-id" ),
128
138
Name : types .StringValue ("folder-name" ),
@@ -135,6 +145,7 @@ func TestMapFolderFields(t *testing.T) {
135
145
{
136
146
description : "nil labels" ,
137
147
uuidContainerParentId : false ,
148
+ respFolderId : & folderUUID ,
138
149
respContainerId : utils .Ptr ("folder-cid" ),
139
150
respName : utils .Ptr ("folder-name" ),
140
151
respCreateTime : & createTime ,
@@ -143,6 +154,7 @@ func TestMapFolderFields(t *testing.T) {
143
154
parent : nil ,
144
155
expected : Model {
145
156
Id : types .StringValue ("folder-cid" ),
157
+ FolderId : types .StringValue (folderUUID ),
146
158
ContainerId : types .StringValue ("folder-cid" ),
147
159
ContainerParentId : types .StringNull (),
148
160
Name : types .StringValue ("folder-name" ),
@@ -196,7 +208,7 @@ func TestMapFolderFields(t *testing.T) {
196
208
// Simulate ContainerParentId configuration based on UUID detection logic
197
209
var containerParentId basetypes.StringValue
198
210
if tt .uuidContainerParentId {
199
- containerParentId = types .StringValue (testUUID )
211
+ containerParentId = types .StringValue (parentContainerUUID )
200
212
} else if tt .parent != nil && tt .parent .ContainerId != nil {
201
213
containerParentId = types .StringValue (* tt .parent .ContainerId )
202
214
} else {
@@ -212,6 +224,7 @@ func TestMapFolderFields(t *testing.T) {
212
224
context .Background (),
213
225
tt .respContainerId ,
214
226
tt .respName ,
227
+ tt .respFolderId ,
215
228
tt .labels ,
216
229
tt .parent ,
217
230
tt .respCreateTime ,
@@ -245,6 +258,7 @@ func TestMapFolderCreateFields(t *testing.T) {
245
258
updateTime := baseTime .Add (1 * time .Hour )
246
259
247
260
resp := & resourcemanager.FolderResponse {
261
+ FolderId : utils .Ptr ("folder-uuid" ),
248
262
ContainerId : utils .Ptr ("folder-id" ),
249
263
Name : utils .Ptr ("my-folder" ),
250
264
Labels : & labels ,
@@ -267,6 +281,7 @@ func TestMapFolderCreateFields(t *testing.T) {
267
281
cbLabels , _ := conversion .ToTerraformStringMap (context .Background (), labels )
268
282
expected := Model {
269
283
Id : types .StringValue ("folder-id" ),
284
+ FolderId : types .StringValue ("folder-uuid" ),
270
285
ContainerId : types .StringValue ("folder-id" ),
271
286
ContainerParentId : types .StringValue (* resp .Parent .Id ),
272
287
Name : types .StringValue ("my-folder" ),
@@ -286,6 +301,7 @@ func TestMapFolderDetailsFields(t *testing.T) {
286
301
updateTime := baseTime .Add (1 * time .Hour )
287
302
288
303
resp := & resourcemanager.GetFolderDetailsResponse {
304
+ FolderId : utils .Ptr ("folder-uuid" ),
289
305
ContainerId : utils .Ptr ("folder-id" ),
290
306
Name : utils .Ptr ("details-folder" ),
291
307
Labels : & map [string ]string {
@@ -308,6 +324,7 @@ func TestMapFolderDetailsFields(t *testing.T) {
308
324
309
325
expected := Model {
310
326
Id : types .StringValue ("folder-id" ),
327
+ FolderId : types .StringValue ("folder-uuid" ),
311
328
ContainerId : types .StringValue ("folder-id" ),
312
329
ContainerParentId : types .StringValue ("parent-container" ),
313
330
Name : types .StringValue ("details-folder" ),
0 commit comments