~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_transport.py

  • Committer: Martin Pool
  • Date: 2010-04-01 04:41:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5128.
  • Revision ID: mbp@sourcefrog.net-20100401044118-shyctqc02ob08ngz
ignore .testrepository

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    TestSkipped,
42
42
    )
43
43
from bzrlib.tests.http_server import HttpServer
 
44
from bzrlib.transport import get_transport
44
45
import bzrlib.transport.http
45
46
 
46
47
if features.paramiko.available():
189
190
        server = stub_sftp.SFTPSiblingAbsoluteServer()
190
191
        server.start_server()
191
192
        try:
192
 
            transport = _mod_transport.get_transport(server.get_url())
 
193
            transport = get_transport(server.get_url())
193
194
            self.assertFalse(transport.abspath('/').endswith('/~/'))
194
195
            self.assertTrue(transport.abspath('/').endswith('/'))
195
196
            del transport
312
313
        """Test that a real connection attempt raises the right error"""
313
314
        from bzrlib.transport import ssh
314
315
        self.set_vendor(ssh.ParamikoVendor())
315
 
        t = _mod_transport.get_transport(self.bogus_url)
 
316
        t = bzrlib.transport.get_transport(self.bogus_url)
316
317
        self.assertRaises(errors.ConnectionError, t.get, 'foobar')
317
318
 
318
319
    def test_bad_connection_ssh(self):
323
324
        # However, 'ssh' will create stipple on the output, so instead
324
325
        # I'm using run_bzr_subprocess, and parsing the output
325
326
        # try:
326
 
        #     t = _mod_transport.get_transport(self.bogus_url)
 
327
        #     t = bzrlib.transport.get_transport(self.bogus_url)
327
328
        # except errors.ConnectionError:
328
329
        #     # Correct error
329
330
        #     pass
504
505
    """Test that AuthenticationConfig can supply default usernames."""
505
506
 
506
507
    def get_transport_for_connection(self, set_config):
507
 
        port = self.get_server().port
 
508
        port = self.get_server()._listener.port
508
509
        if set_config:
509
510
            conf = config.AuthenticationConfig()
510
511
            conf._get_config().update(
511
512
                {'sftptest': {'scheme': 'ssh', 'port': port, 'user': 'bar'}})
512
513
            conf._save()
513
 
        t = _mod_transport.get_transport('sftp://localhost:%d' % port)
 
514
        t = get_transport('sftp://localhost:%d' % port)
514
515
        # force a connection to be performed.
515
516
        t.has('foo')
516
517
        return t