/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from cStringIO import StringIO
22
22
 
23
23
import bzrlib
 
24
from bzrlib import urlutils
24
25
from bzrlib.errors import (NoSuchFile, FileExists,
25
26
                           TransportNotPossible,
26
27
                           ConnectionError,
40
41
from bzrlib.transport.local import LocalTransport
41
42
 
42
43
 
 
44
# TODO: Should possibly split transport-specific tests into their own files.
 
45
 
 
46
 
43
47
class TestTransport(TestCase):
44
48
    """Test the non transport-concrete class functionality."""
45
49
 
337
341
        server = fakenfs.FakeNFSServer()
338
342
        server.setUp()
339
343
        try:
340
 
            # the server should be a relpath localhost server
341
 
            self.assertEqual(server.get_url(), 'fakenfs+.')
 
344
            # the url should be decorated appropriately
 
345
            self.assertStartsWith(server.get_url(), 'fakenfs+')
342
346
            # and we should be able to get a transport for it
343
347
            transport = get_transport(server.get_url())
344
348
            # which must be a FakeNFSTransportDecorator instance.
432
436
            # regular connection behaviour by direct construction.
433
437
            t = self.transport_class(base_url)
434
438
        return t
 
439
 
 
440
 
 
441
class TestLocalTransports(TestCase):
 
442
 
 
443
    def test_get_transport_from_abspath(self):
 
444
        here = os.path.abspath('.')
 
445
        t = get_transport(here)
 
446
        self.assertIsInstance(t, LocalTransport)
 
447
        self.assertEquals(t.base, urlutils.local_path_to_url(here) + '/')
 
448
 
 
449
    def test_get_transport_from_relpath(self):
 
450
        here = os.path.abspath('.')
 
451
        t = get_transport('.')
 
452
        self.assertIsInstance(t, LocalTransport)
 
453
        self.assertEquals(t.base, urlutils.local_path_to_url('.') + '/')
 
454
 
 
455
    def test_get_transport_from_local_url(self):
 
456
        here = os.path.abspath('.')
 
457
        here_url = urlutils.local_path_to_url(here) + '/'
 
458
        t = get_transport(here_url)
 
459
        self.assertIsInstance(t, LocalTransport)
 
460
        self.assertEquals(t.base, here_url)