~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_transport.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-15 23:39:42 UTC
  • mfrom: (2013.1.3 fix-sftp-vendor)
  • Revision ID: pqm@pqm.ubuntu.com-20060915233942-f1b47109b9823f89
(spiv,jam) fallback to Paramiko if ssh is not available

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import bzrlib.bzrdir as bzrdir
23
23
import bzrlib.errors as errors
24
 
from bzrlib.osutils import pathjoin, lexists
 
24
from bzrlib.osutils import pathjoin, lexists, set_or_unset_env
25
25
from bzrlib.tests import TestCaseWithTransport, TestCase, TestSkipped
26
26
import bzrlib.transport
27
27
import bzrlib.transport.http
197
197
                    'invalid port number ~janneke in url:\n'
198
198
                    'sftp://lilypond.org:~janneke/public_html/bzr/gub ')
199
199
 
 
200
    def test_get_paramiko_vendor(self):
 
201
        """Test that if no 'ssh' is available we get builtin paramiko"""
 
202
        from bzrlib.transport import ssh
 
203
        # set '.' as the only location in the path, forcing no 'ssh' to exist
 
204
        orig_vendor = ssh._ssh_vendor
 
205
        orig_path = set_or_unset_env('PATH', '.')
 
206
        try:
 
207
            # No vendor defined yet, query for one
 
208
            ssh._ssh_vendor = None
 
209
            vendor = ssh._get_ssh_vendor()
 
210
            self.assertIsInstance(vendor, ssh.ParamikoVendor)
 
211
        finally:
 
212
            set_or_unset_env('PATH', orig_path)
 
213
            ssh._ssh_vendor = orig_vendor
 
214
 
200
215
 
201
216
class SFTPBranchTest(TestCaseWithSFTPServer):
202
217
    """Test some stuff when accessing a bzr Branch over sftp"""