~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

  • Committer: Andrew Bennetts
  • Date: 2006-09-12 06:47:51 UTC
  • mto: (1752.2.81 remote bzrdir)
  • mto: This revision was merged to the branch mainline in revision 2015.
  • Revision ID: andrew.bennetts@canonical.com-20060912064751-6a7029b08372ee0e
Add a new method ``Transport.get_smart_client()``. This is provided to allow
upgrades to a richer interface than the VFS one provided by Transport. (Andrew
Bennetts, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    urlutils,
31
31
    )
32
32
from bzrlib.errors import (DirectoryNotEmpty, NoSuchFile, FileExists,
33
 
                           LockError, PathError,
 
33
                           LockError, NoSmartServer, PathError,
34
34
                           TransportNotPossible, ConnectionError,
35
35
                           InvalidURL)
36
36
from bzrlib.osutils import getcwd
37
37
from bzrlib.tests import TestCaseInTempDir, TestSkipped
38
38
from bzrlib.tests.test_transport import TestTransportImplementation
39
 
from bzrlib.transport import memory
 
39
from bzrlib.transport import memory, smart
40
40
import bzrlib.transport
41
41
 
42
42
 
1074
1074
        self.assertEqual(d[2], (0, '0'))
1075
1075
        self.assertEqual(d[3], (3, '34'))
1076
1076
 
 
1077
    def test_get_smart_client(self):
 
1078
        """All transports must either give a smart client, or know they can't.
 
1079
 
 
1080
        For some transports such as http this might depend on probing to see 
 
1081
        what's actually present on the other end.  (But we can adjust for that 
 
1082
        in the future.)
 
1083
        """
 
1084
        transport = self.get_transport()
 
1085
        try:
 
1086
            client = transport.get_smart_client()
 
1087
            # XXX: should be a more general class
 
1088
            self.assertIsInstance(client, smart.SmartStreamClient)
 
1089
        except NoSmartServer:
 
1090
            # as long as we got it we're fine
 
1091
            pass