11 async def test_add_machine(event_loop
):
12 from juju
.machine
import Machine
14 async with base
.CleanModel() as model
:
15 # add a new default machine
16 machine1
= await model
.add_machine()
18 # add a machine with constraints, disks, and series
19 machine2
= await model
.add_machine(
31 # add a lxd container to machine2
32 machine3
= await model
.add_machine(
33 'lxd:{}'.format(machine2
.id))
35 for m
in (machine1
, machine2
, machine3
):
36 assert isinstance(m
, Machine
)
38 assert len(model
.machines
) == 3
40 await machine3
.destroy(force
=True)
41 await machine2
.destroy(force
=True)
42 res
= await machine1
.destroy(force
=True)
45 assert len(model
.machines
) == 0