~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_serve.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-16 22:42:54 UTC
  • mfrom: (4797.3.21 2.1.0b4-win32-accepted)
  • Revision ID: pqm@pqm.ubuntu.com-20091116224254-fgspnq9xz29z662j
(jam) Lots of win32 test-suite fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    errors,
31
31
    osutils,
32
32
    revision as _mod_revision,
 
33
    urlutils,
33
34
    )
34
35
from bzrlib.branch import Branch
35
36
from bzrlib.bzrdir import BzrDir
278
279
        (optionally decorated with 'readonly+').  BzrServerFactory can
279
280
        determine the original --directory from that transport.
280
281
        """
 
282
        # URLs always include the trailing slash, and get_base_path returns it
 
283
        base_dir = osutils.abspath('/a/b/c') + '/'
 
284
        base_url = urlutils.local_path_to_url(base_dir) + '/'
281
285
        # Define a fake 'protocol' to capture the transport that cmd_serve
282
286
        # passes to serve_bzr.
283
287
        def capture_transport(transport, host, port, inet):
284
288
            self.bzr_serve_transport = transport
285
289
        cmd = builtins.cmd_serve()
286
290
        # Read-only
287
 
        cmd.run(directory='/a/b/c', protocol=capture_transport)
 
291
        cmd.run(directory=base_dir, protocol=capture_transport)
288
292
        server_maker = BzrServerFactory()
289
293
        self.assertEqual(
290
 
            'readonly+file:///a/b/c/', self.bzr_serve_transport.base)
 
294
            'readonly+%s' % base_url, self.bzr_serve_transport.base)
291
295
        self.assertEqual(
292
 
            u'/a/b/c/', server_maker.get_base_path(self.bzr_serve_transport))
 
296
            base_dir, server_maker.get_base_path(self.bzr_serve_transport))
293
297
        # Read-write
294
 
        cmd.run(directory='/a/b/c', protocol=capture_transport,
 
298
        cmd.run(directory=base_dir, protocol=capture_transport,
295
299
            allow_writes=True)
296
300
        server_maker = BzrServerFactory()
297
 
        self.assertEqual('file:///a/b/c/', self.bzr_serve_transport.base)
298
 
        self.assertEqual(
299
 
            u'/a/b/c/', server_maker.get_base_path(self.bzr_serve_transport))
 
301
        self.assertEqual(base_url, self.bzr_serve_transport.base)
 
302
        self.assertEqual(base_dir,
 
303
            server_maker.get_base_path(self.bzr_serve_transport))
300
304