def test_add_plug_sock(self): brick = stubs.BrickStub(self.factory, "test") sock = vm.VMSock(self.factory.new_sock(brick)) plug = self.vm.add_plug(sock) self.assertEqual(plug.mode, "vde") self.assertEqual(len(self.vm.plugs), 1) self.assertIs(plug.sock, sock) self.assertEqual(len(sock.plugs), 1)
def sock_factory(brick): return vm.VMSock(link.Sock(brick))