@@ -35,6 +35,7 @@ def test_constructor_defaults(self):
3535 self .assertIsNone (project .number )
3636 self .assertEqual (project .labels , {})
3737 self .assertIsNone (project .status )
38+ self .assertIsNone (project .parent )
3839
3940 def test_constructor_explicit (self ):
4041 client = object ()
@@ -49,6 +50,7 @@ def test_constructor_explicit(self):
4950 self .assertIsNone (project .number )
5051 self .assertEqual (project .labels , LABELS )
5152 self .assertIsNone (project .status )
53+ self .assertIsNone (project .parent )
5254
5355 def test_from_api_repr (self ):
5456 client = object ()
@@ -57,18 +59,22 @@ def test_from_api_repr(self):
5759 PROJECT_NUMBER = 12345678
5860 PROJECT_LABELS = {'env' : 'prod' }
5961 PROJECT_LIFECYCLE_STATE = 'ACTIVE'
62+ PARENT = {'type' : 'organization' , 'id' : '433637338579' }
63+
6064 resource = {'projectId' : PROJECT_ID ,
6165 'name' : PROJECT_NAME ,
6266 'projectNumber' : PROJECT_NUMBER ,
6367 'labels' : PROJECT_LABELS ,
64- 'lifecycleState' : PROJECT_LIFECYCLE_STATE }
68+ 'lifecycleState' : PROJECT_LIFECYCLE_STATE ,
69+ 'parent' : PARENT }
6570 project = self ._get_target_class ().from_api_repr (resource , client )
6671 self .assertEqual (project .project_id , PROJECT_ID )
6772 self .assertEqual (project ._client , client )
6873 self .assertEqual (project .name , PROJECT_NAME )
6974 self .assertEqual (project .number , PROJECT_NUMBER )
7075 self .assertEqual (project .labels , PROJECT_LABELS )
7176 self .assertEqual (project .status , PROJECT_LIFECYCLE_STATE )
77+ self .assertEqual (project .parent , PARENT )
7278
7379 def test_full_name (self ):
7480 PROJECT_ID = 'project-id'
@@ -94,6 +100,10 @@ def test_create(self):
94100 'name' : 'Project Name' ,
95101 'labels' : {},
96102 'lifecycleState' : 'ACTIVE' ,
103+ 'parent' : {
104+ 'type' : 'organization' ,
105+ 'id' : '433637338589' ,
106+ },
97107 }
98108 connection = _Connection (PROJECT_RESOURCE )
99109 client = _Client (connection = connection )
@@ -123,6 +133,10 @@ def test_reload(self):
123133 'name' : 'Project Name' ,
124134 'labels' : {'env' : 'prod' },
125135 'lifecycleState' : 'ACTIVE' ,
136+ 'parent' : {
137+ 'type' : 'organization' ,
138+ 'id' : '433637338579' ,
139+ },
126140 }
127141 connection = _Connection (PROJECT_RESOURCE )
128142 client = _Client (connection = connection )
@@ -197,6 +211,7 @@ def test_update(self):
197211 'data' : {
198212 'name' : PROJECT_NAME ,
199213 'labels' : LABELS ,
214+ 'parent' : None ,
200215 },
201216 'path' : project .path ,
202217 }
@@ -211,6 +226,10 @@ def test_delete_without_reload_data(self):
211226 'name' : 'Project Name' ,
212227 'labels' : {'env' : 'prod' },
213228 'lifecycleState' : 'ACTIVE' ,
229+ 'parent' : {
230+ 'type' : 'organization' ,
231+ 'id' : '433637338579' ,
232+ },
214233 }
215234 connection = _Connection (PROJECT_RESOURCE )
216235 client = _Client (connection = connection )
@@ -234,6 +253,10 @@ def test_delete_with_reload_data(self):
234253 'name' : 'Project Name' ,
235254 'labels' : {'env' : 'prod' },
236255 'lifecycleState' : 'ACTIVE' ,
256+ 'parent' : {
257+ 'type' : 'organization' ,
258+ 'id' : '433637338579' ,
259+ },
237260 }
238261 DELETING_PROJECT = PROJECT_RESOURCE .copy ()
239262 DELETING_PROJECT ['lifecycleState' ] = NEW_STATE = 'DELETE_REQUESTED'
@@ -268,6 +291,10 @@ def test_undelete_without_reload_data(self):
268291 'name' : 'Project Name' ,
269292 'labels' : {'env' : 'prod' },
270293 'lifecycleState' : 'DELETE_REQUESTED' ,
294+ 'parent' : {
295+ 'type' : 'organization' ,
296+ 'id' : '433637338579' ,
297+ },
271298 }
272299 connection = _Connection (PROJECT_RESOURCE )
273300 client = _Client (connection = connection )
@@ -291,6 +318,10 @@ def test_undelete_with_reload_data(self):
291318 'name' : 'Project Name' ,
292319 'labels' : {'env' : 'prod' },
293320 'lifecycleState' : 'DELETE_REQUESTED' ,
321+ 'parent' : {
322+ 'type' : 'organization' ,
323+ 'id' : '433637338579' ,
324+ },
294325 }
295326 UNDELETED_PROJECT = PROJECT_RESOURCE .copy ()
296327 UNDELETED_PROJECT ['lifecycleState' ] = NEW_STATE = 'ACTIVE'
0 commit comments