예제 #1
0
    def tearDown(self):
        """See `LaunchpadInternalServer.tearDown`.

        In addition to calling the overridden method, we tear down any
        ChrootServer instances we've set up.
        """
        for chroot_server in self._chroot_servers:
            chroot_server.stop_server()
        LaunchpadInternalServer.tearDown(self)
예제 #2
0
    def tearDown(self):
        """See `LaunchpadInternalServer.tearDown`.

        In addition to calling the overridden method, we tear down any
        ChrootServer instances we've set up.
        """
        for chroot_server in self._chroot_servers:
            chroot_server.stop_server()
        LaunchpadInternalServer.tearDown(self)
예제 #3
0
    def __init__(self):
        """Initialize the server.

        We register ourselves with the scheme lp-testing=${id(self)}:/// using
        an in-memory XML-RPC client and backed onto a LocalTransport.
        """
        frontend = InMemoryFrontend()
        branchfs = frontend.getCodehostingEndpoint()
        branch = frontend.getLaunchpadObjectFactory().makeAnyBranch()
        self._branch_path = branch.unique_name
        # XXX: JonathanLange bug=276972 2008-10-07: This should back on to a
        # MemoryTransport, but a bug in Bazaar's implementation makes it
        # unreliable for tests that involve particular errors.
        LaunchpadInternalServer.__init__(
            self, 'lp-testing-%s:///' % id(self),
            DeferredBlockingProxy(branchfs),
            LocalTransport(local_path_to_url('.')))
        self._chroot_servers = []
예제 #4
0
    def __init__(self):
        """Initialize the server.

        We register ourselves with the scheme lp-testing=${id(self)}:/// using
        an in-memory XML-RPC client and backed onto a LocalTransport.
        """
        frontend = InMemoryFrontend()
        branchfs = frontend.getCodehostingEndpoint()
        branch = frontend.getLaunchpadObjectFactory().makeAnyBranch()
        self._branch_path = branch.unique_name
        # XXX: JonathanLange bug=276972 2008-10-07: This should back on to a
        # MemoryTransport, but a bug in Bazaar's implementation makes it
        # unreliable for tests that involve particular errors.
        LaunchpadInternalServer.__init__(
            self, 'lp-testing-%s:///' % id(self),
            DeferredBlockingProxy(branchfs),
            LocalTransport(local_path_to_url('.')))
        self._chroot_servers = []
예제 #5
0
    def _transportFactory(self, url):
        """See `LaunchpadInternalServer._transportFactory`.

        As `LaunchpadTransport` 'acts all kinds of crazy' above the .bzr
        directory of a branch (forbidding file or directory creation at some
        levels, enforcing naming restrictions at others), we test a
        LaunchpadTransport chrooted into the .bzr directory of a branch.
        """
        if not url.startswith(self._scheme):
            raise AssertionError("Wrong transport scheme.")
        root_transport = LaunchpadInternalServer._transportFactory(
            self, self._scheme)
        relpath = root_transport.relpath(url)
        bzrdir_transport = root_transport.clone(
            self._branch_path).clone('.bzr')
        bzrdir_transport.ensure_base()
        chroot_server = chroot.ChrootServer(bzrdir_transport)
        chroot_server.start_server()
        self._chroot_servers.append(chroot_server)
        return get_transport(chroot_server.get_url()).clone(relpath)
예제 #6
0
    def _transportFactory(self, url):
        """See `LaunchpadInternalServer._transportFactory`.

        As `LaunchpadTransport` 'acts all kinds of crazy' above the .bzr
        directory of a branch (forbidding file or directory creation at some
        levels, enforcing naming restrictions at others), we test a
        LaunchpadTransport chrooted into the .bzr directory of a branch.
        """
        if not url.startswith(self._scheme):
            raise AssertionError("Wrong transport scheme.")
        root_transport = LaunchpadInternalServer._transportFactory(
            self, self._scheme)
        relpath = root_transport.relpath(url)
        bzrdir_transport = root_transport.clone(
            self._branch_path).clone('.bzr')
        bzrdir_transport.ensure_base()
        chroot_server = chroot.ChrootServer(bzrdir_transport)
        chroot_server.start_server()
        self._chroot_servers.append(chroot_server)
        return get_transport(chroot_server.get_url()).clone(relpath)
예제 #7
0
 def getLaunchpadServer(self, codehosting_api, user_id):
     return LaunchpadInternalServer('lp-test:///',
                                    XMLRPCWrapper(codehosting_api),
                                    MemoryTransport())