@@ -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,22 @@ 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' : '433637338579' }
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 }
65
70
project = self ._get_target_class ().from_api_repr (resource , client )
66
71
self .assertEqual (project .project_id , PROJECT_ID )
67
72
self .assertEqual (project ._client , client )
68
73
self .assertEqual (project .name , PROJECT_NAME )
69
74
self .assertEqual (project .number , PROJECT_NUMBER )
70
75
self .assertEqual (project .labels , PROJECT_LABELS )
71
76
self .assertEqual (project .status , PROJECT_LIFECYCLE_STATE )
77
+ self .assertEqual (project .parent , PARENT )
72
78
73
79
def test_full_name (self ):
74
80
PROJECT_ID = 'project-id'
@@ -94,6 +100,10 @@ def test_create(self):
94
100
'name' : 'Project Name' ,
95
101
'labels' : {},
96
102
'lifecycleState' : 'ACTIVE' ,
103
+ 'parent' : {
104
+ 'type' : 'organization' ,
105
+ 'id' : '433637338589' ,
106
+ },
97
107
}
98
108
connection = _Connection (PROJECT_RESOURCE )
99
109
client = _Client (connection = connection )
@@ -123,6 +133,10 @@ def test_reload(self):
123
133
'name' : 'Project Name' ,
124
134
'labels' : {'env' : 'prod' },
125
135
'lifecycleState' : 'ACTIVE' ,
136
+ 'parent' : {
137
+ 'type' : 'organization' ,
138
+ 'id' : '433637338579' ,
139
+ },
126
140
}
127
141
connection = _Connection (PROJECT_RESOURCE )
128
142
client = _Client (connection = connection )
@@ -197,6 +211,7 @@ def test_update(self):
197
211
'data' : {
198
212
'name' : PROJECT_NAME ,
199
213
'labels' : LABELS ,
214
+ 'parent' : None ,
200
215
},
201
216
'path' : project .path ,
202
217
}
@@ -211,6 +226,10 @@ def test_delete_without_reload_data(self):
211
226
'name' : 'Project Name' ,
212
227
'labels' : {'env' : 'prod' },
213
228
'lifecycleState' : 'ACTIVE' ,
229
+ 'parent' : {
230
+ 'type' : 'organization' ,
231
+ 'id' : '433637338579' ,
232
+ },
214
233
}
215
234
connection = _Connection (PROJECT_RESOURCE )
216
235
client = _Client (connection = connection )
@@ -234,6 +253,10 @@ def test_delete_with_reload_data(self):
234
253
'name' : 'Project Name' ,
235
254
'labels' : {'env' : 'prod' },
236
255
'lifecycleState' : 'ACTIVE' ,
256
+ 'parent' : {
257
+ 'type' : 'organization' ,
258
+ 'id' : '433637338579' ,
259
+ },
237
260
}
238
261
DELETING_PROJECT = PROJECT_RESOURCE .copy ()
239
262
DELETING_PROJECT ['lifecycleState' ] = NEW_STATE = 'DELETE_REQUESTED'
@@ -268,6 +291,10 @@ def test_undelete_without_reload_data(self):
268
291
'name' : 'Project Name' ,
269
292
'labels' : {'env' : 'prod' },
270
293
'lifecycleState' : 'DELETE_REQUESTED' ,
294
+ 'parent' : {
295
+ 'type' : 'organization' ,
296
+ 'id' : '433637338579' ,
297
+ },
271
298
}
272
299
connection = _Connection (PROJECT_RESOURCE )
273
300
client = _Client (connection = connection )
@@ -291,6 +318,10 @@ def test_undelete_with_reload_data(self):
291
318
'name' : 'Project Name' ,
292
319
'labels' : {'env' : 'prod' },
293
320
'lifecycleState' : 'DELETE_REQUESTED' ,
321
+ 'parent' : {
322
+ 'type' : 'organization' ,
323
+ 'id' : '433637338579' ,
324
+ },
294
325
}
295
326
UNDELETED_PROJECT = PROJECT_RESOURCE .copy ()
296
327
UNDELETED_PROJECT ['lifecycleState' ] = NEW_STATE = 'ACTIVE'
0 commit comments