~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

[merge] jam-integration 1527, including branch-formats, help text, misc bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib.tests import TestCase
27
27
from bzrlib.transport import (_get_protocol_handlers,
28
28
                              _get_transport_modules,
 
29
                              get_transport,
29
30
                              register_lazy_transport,
30
31
                              _set_protocol_handlers,
31
32
                              urlescape, urlunescape
85
86
        self.assertEqual(True, transport.listable())
86
87
        self.assertEqual(False, transport.should_cache())
87
88
        self.assertEqual(False, transport.is_readonly())
 
89
        
 
90
        
 
91
class ReadonlyDecoratorTransportTest(TestCase):
 
92
    """Readonly decoration specific tests."""
 
93
 
 
94
    def test_local_parameters(self):
 
95
        import bzrlib.transport.readonly as readonly
 
96
        # connect to . in readonly mode
 
97
        transport = readonly.ReadonlyTransportDecorator('readonly+.')
 
98
        self.assertEqual(True, transport.listable())
 
99
        self.assertEqual(False, transport.should_cache())
 
100
        self.assertEqual(True, transport.is_readonly())
 
101
 
 
102
    def test_http_parameters(self):
 
103
        import bzrlib.transport.readonly as readonly
 
104
        from bzrlib.transport.http import HttpServer
 
105
        # connect to . via http which is not listable
 
106
        server = HttpServer()
 
107
        server.setUp()
 
108
        try:
 
109
            transport = get_transport('readonly+' + server.get_url())
 
110
            self.failUnless(isinstance(transport,
 
111
                                       readonly.ReadonlyTransportDecorator))
 
112
            self.assertEqual(False, transport.listable())
 
113
            self.assertEqual(True, transport.should_cache())
 
114
            self.assertEqual(True, transport.is_readonly())
 
115
        finally:
 
116
            server.tearDown()