Ejemplo n.º 1
0
 def test_network_deleted_if_create_true(self, m_lxc):
     """deletion of network should occur if create is True."""
     cc_lxd.maybe_cleanup_default(net_name=self.defnet,
                                  did_init=True,
                                  create=True,
                                  attach=False)
     m_lxc.assert_called_once_with(["network", "delete", self.defnet])
Ejemplo n.º 2
0
 def test_did_init_false_does_not_delete(self, m_lxc):
     """deletion or removal should only occur if did_init is True."""
     cc_lxd.maybe_cleanup_default(net_name=self.defnet,
                                  did_init=False,
                                  create=True,
                                  attach=True)
     m_lxc.assert_not_called()
Ejemplo n.º 3
0
 def test_network_other_than_default_not_deleted(self, m_lxc):
     """deletion or removal should only occur if bridge is default."""
     cc_lxd.maybe_cleanup_default(net_name="lxdbr1",
                                  did_init=True,
                                  create=True,
                                  attach=True)
     m_lxc.assert_not_called()
Ejemplo n.º 4
0
 def test_device_removed_if_attach_true(self, m_lxc):
     """deletion of network should occur if create is True."""
     nic_name = "my_nic"
     profile = "my_profile"
     cc_lxd.maybe_cleanup_default(
         net_name=self.defnet, did_init=True, create=False, attach=True,
         profile=profile, nic_name=nic_name)
     m_lxc.assert_called_once_with(
         ["profile", "device", "remove", profile, nic_name])
Ejemplo n.º 5
0
 def test_network_deleted_if_create_true(self, m_lxc):
     """deletion of network should occur if create is True."""
     cc_lxd.maybe_cleanup_default(
         net_name=self.defnet, did_init=True, create=True, attach=False)
     m_lxc.assert_called_once_with(["network", "delete", self.defnet])
Ejemplo n.º 6
0
 def test_did_init_false_does_not_delete(self, m_lxc):
     """deletion or removal should only occur if did_init is True."""
     cc_lxd.maybe_cleanup_default(
         net_name=self.defnet, did_init=False, create=True, attach=True)
     m_lxc.assert_not_called()
Ejemplo n.º 7
0
 def test_network_other_than_default_not_deleted(self, m_lxc):
     """deletion or removal should only occur if bridge is default."""
     cc_lxd.maybe_cleanup_default(
         net_name="lxdbr1", did_init=True, create=True, attach=True)
     m_lxc.assert_not_called()