def test_iface_to_br_handles_ovs_vsctl_exception(self): iface = 'tap0' root_helper = 'sudo' utils.execute(["ovs-vsctl", self.TO, "iface-to-br", iface], root_helper=root_helper).AndRaise(Exception) self.mox.ReplayAll() self.assertIsNone(ovs_lib.get_bridge_for_iface(root_helper, iface)) self.mox.VerifyAll()
def test_iface_to_br(self): iface = 'tap0' br = 'br-int' root_helper = 'sudo' utils.execute(["ovs-vsctl", self.TO, "iface-to-br", iface], root_helper=root_helper).AndReturn('br-int') self.mox.ReplayAll() self.assertEqual(ovs_lib.get_bridge_for_iface(root_helper, iface), br) self.mox.VerifyAll()