@@ -35,6 +35,7 @@ def test_constructor_defaults(self):
35
35
self .assertIsNone (project .number )
36
36
self .assertEqual (project .labels , {})
37
37
self .assertIsNone (project .status )
38
+ self .assertIsNone (project .parent )
38
39
39
40
def test_constructor_explicit (self ):
40
41
client = object ()
@@ -49,6 +50,7 @@ def test_constructor_explicit(self):
49
50
self .assertIsNone (project .number )
50
51
self .assertEqual (project .labels , LABELS )
51
52
self .assertIsNone (project .status )
53
+ self .assertIsNone (project .parent )
52
54
53
55
def test_from_api_repr (self ):
54
56
client = object ()
@@ -57,18 +59,23 @@ def test_from_api_repr(self):
57
59
PROJECT_NUMBER = 12345678
58
60
PROJECT_LABELS = {'env' : 'prod' }
59
61
PROJECT_LIFECYCLE_STATE = 'ACTIVE'
62
+ PARENT = {'type' : 'organization' , 'id' : 433637338589 }
63
+
60
64
resource = {'projectId' : PROJECT_ID ,
61
65
'name' : PROJECT_NAME ,
62
66
'projectNumber' : PROJECT_NUMBER ,
63
67
'labels' : PROJECT_LABELS ,
64
- 'lifecycleState' : PROJECT_LIFECYCLE_STATE }
68
+ 'lifecycleState' : PROJECT_LIFECYCLE_STATE ,
69
+ 'parent' : PARENT
70
+ }
65
71
project = self ._get_target_class ().from_api_repr (resource , client )
66
72
self .assertEqual (project .project_id , PROJECT_ID )
67
73
self .assertEqual (project ._client , client )
68
74
self .assertEqual (project .name , PROJECT_NAME )
69
75
self .assertEqual (project .number , PROJECT_NUMBER )
70
76
self .assertEqual (project .labels , PROJECT_LABELS )
71
77
self .assertEqual (project .status , PROJECT_LIFECYCLE_STATE )
78
+ self .assertEqual (project .parent , PARENT )
72
79
73
80
def test_full_name (self ):
74
81
PROJECT_ID = 'project-id'
@@ -94,6 +101,10 @@ def test_create(self):
94
101
'name' : 'Project Name' ,
95
102
'labels' : {},
96
103
'lifecycleState' : 'ACTIVE' ,
104
+ 'parent' : {
105
+ 'type' : 'organization' ,
106
+ 'id' : 433637338589
107
+ }
97
108
}
98
109
connection = _Connection (PROJECT_RESOURCE )
99
110
client = _Client (connection = connection )
@@ -123,6 +134,10 @@ def test_reload(self):
123
134
'name' : 'Project Name' ,
124
135
'labels' : {'env' : 'prod' },
125
136
'lifecycleState' : 'ACTIVE' ,
137
+ 'parent' : {
138
+ 'type' : 'organization' ,
139
+ 'id' : 433637338589
140
+ }
126
141
}
127
142
connection = _Connection (PROJECT_RESOURCE )
128
143
client = _Client (connection = connection )
@@ -183,6 +198,10 @@ def test_update(self):
183
198
'name' : PROJECT_NAME ,
184
199
'labels' : LABELS ,
185
200
'lifecycleState' : 'ACTIVE' ,
201
+ 'parent' : {
202
+ 'type' : 'organization' ,
203
+ 'id' : 433637338589
204
+ }
186
205
}
187
206
connection = _Connection (PROJECT_RESOURCE )
188
207
client = _Client (connection = connection )
@@ -211,6 +230,10 @@ def test_delete_without_reload_data(self):
211
230
'name' : 'Project Name' ,
212
231
'labels' : {'env' : 'prod' },
213
232
'lifecycleState' : 'ACTIVE' ,
233
+ 'parent' : {
234
+ 'type' : 'organization' ,
235
+ 'id' : 433637338589
236
+ }
214
237
}
215
238
connection = _Connection (PROJECT_RESOURCE )
216
239
client = _Client (connection = connection )
@@ -234,6 +257,10 @@ def test_delete_with_reload_data(self):
234
257
'name' : 'Project Name' ,
235
258
'labels' : {'env' : 'prod' },
236
259
'lifecycleState' : 'ACTIVE' ,
260
+ 'parent' : {
261
+ 'type' : 'organization' ,
262
+ 'id' : 433637338589
263
+ }
237
264
}
238
265
DELETING_PROJECT = PROJECT_RESOURCE .copy ()
239
266
DELETING_PROJECT ['lifecycleState' ] = NEW_STATE = 'DELETE_REQUESTED'
@@ -268,6 +295,10 @@ def test_undelete_without_reload_data(self):
268
295
'name' : 'Project Name' ,
269
296
'labels' : {'env' : 'prod' },
270
297
'lifecycleState' : 'DELETE_REQUESTED' ,
298
+ 'parent' : {
299
+ 'type' : 'organization' ,
300
+ 'id' : 433637338589
301
+ }
271
302
}
272
303
connection = _Connection (PROJECT_RESOURCE )
273
304
client = _Client (connection = connection )
@@ -291,6 +322,10 @@ def test_undelete_with_reload_data(self):
291
322
'name' : 'Project Name' ,
292
323
'labels' : {'env' : 'prod' },
293
324
'lifecycleState' : 'DELETE_REQUESTED' ,
325
+ 'parent' : {
326
+ 'type' : 'organization' ,
327
+ 'id' : 433637338589
328
+ }
294
329
}
295
330
UNDELETED_PROJECT = PROJECT_RESOURCE .copy ()
296
331
UNDELETED_PROJECT ['lifecycleState' ] = NEW_STATE = 'ACTIVE'
0 commit comments