~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_server.py

  • Committer: Vincent Ladeuil
  • Date: 2010-02-09 20:33:43 UTC
  • mto: (5029.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5030.
  • Revision ID: v.ladeuil+lp@free.fr-20100209203343-ktxx7t0xvptvjnt1
Move TestingPathFilteringServer to bzrlib.tests.test_server

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    transport,
19
19
    urlutils,
20
20
    )
 
21
from bzrlib.transport import (
 
22
    pathfilter,
 
23
    )
21
24
from bzrlib.smart import server
22
25
 
23
26
 
206
209
        return unlistable.UnlistableTransportDecorator
207
210
 
208
211
 
 
212
class TestingPathFilteringServer(pathfilter.PathFilteringServer):
 
213
 
 
214
    def __init__(self):
 
215
        """TestingChrootServer is not usable until start_server is called."""
 
216
 
 
217
    def start_server(self, backing_server=None):
 
218
        """Setup the Chroot on backing_server."""
 
219
        if backing_server is not None:
 
220
            self.backing_transport = transport.get_transport(
 
221
                backing_server.get_url())
 
222
        else:
 
223
            self.backing_transport = transport.get_transport('.')
 
224
        self.backing_transport.clone('added-by-filter').ensure_base()
 
225
        self.filter_func = lambda x: 'added-by-filter/' + x
 
226
        super(TestingPathFilteringServer, self).start_server()
 
227
 
 
228
 
209
229
class SmartTCPServer_for_testing(server.SmartTCPServer):
210
230
    """Server suitable for use by transport tests.
211
231