~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: Jonathan Riddell
  • Date: 2011-09-15 10:03:58 UTC
  • mfrom: (6138.2.5 i18n-gettext-strings)
  • mto: This revision was merged to the branch mainline in revision 6143.
  • Revision ID: jriddell@canonical.com-20110915100358-cz5jujhsnb0tac9s
mergeĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
        errors,
29
29
        osutils,
30
30
        tests,
31
 
        transport,
 
31
        transport as _mod_transport,
32
32
        urlutils,
33
33
        )
34
34
from bzrlib.smart import (
37
37
        message,
38
38
        protocol,
39
39
        request as _mod_request,
40
 
        server,
 
40
        server as _mod_server,
41
41
        vfs,
42
42
)
43
43
from bzrlib.tests import (
1015
1015
            mem_server.start_server()
1016
1016
            self.addCleanup(mem_server.stop_server)
1017
1017
            self.permit_url(mem_server.get_url())
1018
 
            self.backing_transport = transport.get_transport_from_url(
 
1018
            self.backing_transport = _mod_transport.get_transport_from_url(
1019
1019
                mem_server.get_url())
1020
1020
        else:
1021
1021
            self.backing_transport = backing_transport
1022
1022
        if readonly:
1023
1023
            self.real_backing_transport = self.backing_transport
1024
 
            self.backing_transport = transport.get_transport_from_url(
 
1024
            self.backing_transport = _mod_transport.get_transport_from_url(
1025
1025
                "readonly+" + self.backing_transport.abspath('.'))
1026
 
        self.server = server.SmartTCPServer(self.backing_transport)
 
1026
        self.server = _mod_server.SmartTCPServer(self.backing_transport)
1027
1027
        self.server.start_server('127.0.0.1', 0)
1028
1028
        self.server.start_background_thread('-' + self.id())
1029
1029
        self.transport = remote.RemoteTCPTransport(self.server.get_url())
1163
1163
    def test_server_started_hook_memory(self):
1164
1164
        """The server_started hook fires when the server is started."""
1165
1165
        self.hook_calls = []
1166
 
        server.SmartTCPServer.hooks.install_named_hook('server_started',
 
1166
        _mod_server.SmartTCPServer.hooks.install_named_hook('server_started',
1167
1167
            self.capture_server_call, None)
1168
1168
        self.start_server()
1169
1169
        # at this point, the server will be starting a thread up.
1177
1177
    def test_server_started_hook_file(self):
1178
1178
        """The server_started hook fires when the server is started."""
1179
1179
        self.hook_calls = []
1180
 
        server.SmartTCPServer.hooks.install_named_hook('server_started',
 
1180
        _mod_server.SmartTCPServer.hooks.install_named_hook('server_started',
1181
1181
            self.capture_server_call, None)
1182
1182
        self.start_server(
1183
 
            backing_transport=transport.get_transport_from_path("."))
 
1183
            backing_transport=_mod_transport.get_transport_from_path("."))
1184
1184
        # at this point, the server will be starting a thread up.
1185
1185
        # there is no indicator at the moment, so bodge it by doing a request.
1186
1186
        self.transport.has('.')
1194
1194
    def test_server_stopped_hook_simple_memory(self):
1195
1195
        """The server_stopped hook fires when the server is stopped."""
1196
1196
        self.hook_calls = []
1197
 
        server.SmartTCPServer.hooks.install_named_hook('server_stopped',
 
1197
        _mod_server.SmartTCPServer.hooks.install_named_hook('server_stopped',
1198
1198
            self.capture_server_call, None)
1199
1199
        self.start_server()
1200
1200
        result = [([self.backing_transport.base], self.transport.base)]
1211
1211
    def test_server_stopped_hook_simple_file(self):
1212
1212
        """The server_stopped hook fires when the server is stopped."""
1213
1213
        self.hook_calls = []
1214
 
        server.SmartTCPServer.hooks.install_named_hook('server_stopped',
 
1214
        _mod_server.SmartTCPServer.hooks.install_named_hook('server_stopped',
1215
1215
            self.capture_server_call, None)
1216
1216
        self.start_server(
1217
 
            backing_transport=transport.get_transport_from_path("."))
 
1217
            backing_transport=_mod_transport.get_transport_from_path("."))
1218
1218
        result = [(
1219
1219
            [self.backing_transport.base, self.backing_transport.external_url()]
1220
1220
            , self.transport.base)]
1356
1356
class RemoteTransportRegistration(tests.TestCase):
1357
1357
 
1358
1358
    def test_registration(self):
1359
 
        t = transport.get_transport_from_url('bzr+ssh://example.com/path')
 
1359
        t = _mod_transport.get_transport_from_url('bzr+ssh://example.com/path')
1360
1360
        self.assertIsInstance(t, remote.RemoteSSHTransport)
1361
1361
        self.assertEqual('example.com', t._parsed_url.host)
1362
1362
 
1363
1363
    def test_bzr_https(self):
1364
1364
        # https://bugs.launchpad.net/bzr/+bug/128456
1365
 
        t = transport.get_transport_from_url('bzr+https://example.com/path')
 
1365
        t = _mod_transport.get_transport_from_url('bzr+https://example.com/path')
1366
1366
        self.assertIsInstance(t, remote.RemoteHTTPTransport)
1367
1367
        self.assertStartsWith(
1368
1368
            t._http_transport.base,