@@ -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,20 +41,22 @@ func TestMapFolderFields(t *testing.T) {
39
41
{
40
42
description : "valid input with UUID parent ID" ,
41
43
uuidContainerParentId : true ,
42
- respContainerId : utils .Ptr ("folder-cid-uuid" ),
44
+ respFolderId : & folderUUID ,
45
+ respContainerId : utils .Ptr ("folder-human-readable-id" ),
43
46
respName : utils .Ptr ("folder-name" ),
44
47
respCreateTime : & createTime ,
45
48
respUpdateTime : & updateTime ,
46
49
labels : & map [string ]string {
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
- Id : types .StringValue ("folder-cid-uuid" ),
54
- ContainerId : types .StringValue ("folder-cid-uuid" ),
55
- ContainerParentId : types .StringValue (testUUID ),
56
+ Id : types .StringValue ("folder-human-readable-id" ),
57
+ FolderId : types .StringValue (folderUUID ),
58
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
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 ,
68
- respContainerId : utils .Ptr ("folder-cid-uuid" ),
72
+ respFolderId : & folderUUID ,
73
+ respContainerId : utils .Ptr ("folder-human-readable-id" ),
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
- Id : types .StringValue ("folder-cid-uuid" ),
78
- ContainerId : types .StringValue ("folder-cid-uuid" ),
79
- ContainerParentId : types .StringValue (testUUID ),
82
+ Id : types .StringValue ("folder-human-readable-id" ),
83
+ FolderId : types .StringValue (folderUUID ),
84
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
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,7 +93,8 @@ func TestMapFolderFields(t *testing.T) {
87
93
{
88
94
description : "valid input with ContainerId as parent" ,
89
95
uuidContainerParentId : false ,
90
- respContainerId : utils .Ptr ("folder-cid" ),
96
+ respFolderId : & folderUUID ,
97
+ respContainerId : utils .Ptr ("folder-human-readable-id" ),
91
98
respName : utils .Ptr ("folder-name" ),
92
99
respCreateTime : & createTime ,
93
100
respUpdateTime : & updateTime ,
@@ -98,8 +105,9 @@ func TestMapFolderFields(t *testing.T) {
98
105
ContainerId : utils .Ptr ("parent-container-id" ),
99
106
},
100
107
expected : Model {
101
- Id : types .StringValue ("folder-cid" ),
102
- ContainerId : types .StringValue ("folder-cid" ),
108
+ Id : types .StringValue ("folder-human-readable-id" ),
109
+ FolderId : types .StringValue (folderUUID ),
110
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
103
111
ContainerParentId : types .StringValue ("parent-container-id" ),
104
112
Name : types .StringValue ("folder-name" ),
105
113
CreationTime : types .StringValue (createTime .Format (time .RFC3339 )),
@@ -113,7 +121,8 @@ func TestMapFolderFields(t *testing.T) {
113
121
{
114
122
description : "valid input with ContainerId as parent no labels" ,
115
123
uuidContainerParentId : false ,
116
- respContainerId : utils .Ptr ("folder-cid" ),
124
+ respFolderId : & folderUUID ,
125
+ respContainerId : utils .Ptr ("folder-human-readable-id" ),
117
126
respName : utils .Ptr ("folder-name" ),
118
127
respCreateTime : & createTime ,
119
128
respUpdateTime : & updateTime ,
@@ -122,8 +131,9 @@ func TestMapFolderFields(t *testing.T) {
122
131
ContainerId : utils .Ptr ("parent-container-id" ),
123
132
},
124
133
expected : Model {
125
- Id : types .StringValue ("folder-cid" ),
126
- ContainerId : types .StringValue ("folder-cid" ),
134
+ Id : types .StringValue ("folder-human-readable-id" ),
135
+ FolderId : types .StringValue (folderUUID ),
136
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
127
137
ContainerParentId : types .StringValue ("parent-container-id" ),
128
138
Name : types .StringValue ("folder-name" ),
129
139
CreationTime : types .StringValue (createTime .Format (time .RFC3339 )),
@@ -135,15 +145,17 @@ func TestMapFolderFields(t *testing.T) {
135
145
{
136
146
description : "nil labels" ,
137
147
uuidContainerParentId : false ,
138
- respContainerId : utils .Ptr ("folder-cid" ),
148
+ respFolderId : & folderUUID ,
149
+ respContainerId : utils .Ptr ("folder-human-readable-id" ),
139
150
respName : utils .Ptr ("folder-name" ),
140
151
respCreateTime : & createTime ,
141
152
respUpdateTime : & updateTime ,
142
153
labels : nil ,
143
154
parent : nil ,
144
155
expected : Model {
145
- Id : types .StringValue ("folder-cid" ),
146
- ContainerId : types .StringValue ("folder-cid" ),
156
+ Id : types .StringValue ("folder-human-readable-id" ),
157
+ FolderId : types .StringValue (folderUUID ),
158
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
147
159
ContainerParentId : types .StringNull (),
148
160
Name : types .StringValue ("folder-name" ),
149
161
CreationTime : types .StringValue (createTime .Format (time .RFC3339 )),
@@ -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,7 +258,8 @@ func TestMapFolderCreateFields(t *testing.T) {
245
258
updateTime := baseTime .Add (1 * time .Hour )
246
259
247
260
resp := & resourcemanager.FolderResponse {
248
- ContainerId : utils .Ptr ("folder-id" ),
261
+ FolderId : utils .Ptr ("folder-uuid" ),
262
+ ContainerId : utils .Ptr ("folder-human-readable-id" ),
249
263
Name : utils .Ptr ("my-folder" ),
250
264
Labels : & labels ,
251
265
Parent : & resourcemanager.Parent {
@@ -266,8 +280,9 @@ func TestMapFolderCreateFields(t *testing.T) {
266
280
267
281
cbLabels , _ := conversion .ToTerraformStringMap (context .Background (), labels )
268
282
expected := Model {
269
- Id : types .StringValue ("folder-id" ),
270
- ContainerId : types .StringValue ("folder-id" ),
283
+ Id : types .StringValue ("folder-human-readable-id" ),
284
+ FolderId : types .StringValue ("folder-uuid" ),
285
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
271
286
ContainerParentId : types .StringValue (* resp .Parent .Id ),
272
287
Name : types .StringValue ("my-folder" ),
273
288
Labels : cbLabels ,
@@ -286,7 +301,8 @@ func TestMapFolderDetailsFields(t *testing.T) {
286
301
updateTime := baseTime .Add (1 * time .Hour )
287
302
288
303
resp := & resourcemanager.GetFolderDetailsResponse {
289
- ContainerId : utils .Ptr ("folder-id" ),
304
+ FolderId : utils .Ptr ("folder-uuid" ),
305
+ ContainerId : utils .Ptr ("folder-human-readable-id" ),
290
306
Name : utils .Ptr ("details-folder" ),
291
307
Labels : & map [string ]string {
292
308
"foo" : "bar" ,
@@ -307,8 +323,9 @@ func TestMapFolderDetailsFields(t *testing.T) {
307
323
tfLabels , _ := conversion .ToTerraformStringMap (context .Background (), * resp .Labels )
308
324
309
325
expected := Model {
310
- Id : types .StringValue ("folder-id" ),
311
- ContainerId : types .StringValue ("folder-id" ),
326
+ Id : types .StringValue ("folder-human-readable-id" ),
327
+ FolderId : types .StringValue ("folder-uuid" ),
328
+ ContainerId : types .StringValue ("folder-human-readable-id" ),
312
329
ContainerParentId : types .StringValue ("parent-container" ),
313
330
Name : types .StringValue ("details-folder" ),
314
331
Labels : tfLabels ,
0 commit comments