@@ -245,25 +245,52 @@ def fail_on_use():
245245 self .machine_data = {self .key : self .key_data }
246246 self .unit = "app/1"
247247 self .application = "app"
248+
248249 self .subordinate_application = "subordinate_application"
249250 self .subordinate_application_data = {
250251 "subordinate-to" : [self .application ],
251252 "units" : None }
252253 self .subordinate_unit = "subordinate_application/1"
253254 self .subordinate_unit_data = {
254255 "workload-status" : {"status" : "active" }}
256+
257+ # Second subordinate app is related both to the principal application
258+ # and to the first subordinate application
259+ self .second_subordinate_application = "second_subordinate_application"
260+ self .second_subordinate_application_data = {
261+ "subordinate-to" : [
262+ self .subordinate_application ,
263+ self .application
264+ ],
265+ "units" : None }
266+ self .second_subordinate_unit = "second_subordinate_application/1"
267+ self .second_subordinate_unit_data = {
268+ "workload-status" : {"status" : "active" }}
269+ # Update the suboridnate list on the first subordinate as well
270+ self .subordinate_application_data ["subordinate-to" ].insert (
271+ 0 ,
272+ self .second_subordinate_application ,
273+ )
274+
255275 self .unit_data = {
256276 "workload-status" : {"status" : "active" },
257277 "machine" : self .machine ,
258278 "subordinates" : {
259- self .subordinate_unit : self .subordinate_unit_data }}
279+ self .subordinate_unit : self .subordinate_unit_data ,
280+ self .second_subordinate_unit :
281+ self .second_subordinate_unit_data ,
282+ }
283+ }
260284 self .application_data = {"units" : {
261285 self .unit1 .name : self .subordinate_unit_data ,
262286 self .unit : self .unit_data }}
263287 self .juju_status = mock .MagicMock ()
264288 self .juju_status .applications = {
265289 self .application : self .application_data ,
266- self .subordinate_application : self .subordinate_application_data }
290+ self .subordinate_application : self .subordinate_application_data ,
291+ self .second_subordinate_application :
292+ self .second_subordinate_application_data ,
293+ }
267294 self .juju_status .machines = self .machine_data
268295
269296 async def _connect_model (model_name ):
0 commit comments