/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_transport.py

  • Committer: Alexander Belchenko
  • Date: 2007-03-13 02:16:17 UTC
  • mfrom: (2346 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2356.
  • Revision ID: bialix@ukr.net-20070313021617-azd5lv30b23gyu48
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Robey Pointer <robey@lag.net>, Canonical Ltd
 
1
# Copyright (C) 2005 Robey Pointer <robey@lag.net>
 
2
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
3
#
3
4
# This program is free software; you can redistribute it and/or modify
4
5
# it under the terms of the GNU General Public License as published by
213
214
        """Test that if no 'ssh' is available we get builtin paramiko"""
214
215
        from bzrlib.transport import ssh
215
216
        # set '.' as the only location in the path, forcing no 'ssh' to exist
216
 
        orig_vendor = ssh._ssh_vendor
 
217
        orig_vendor = ssh._ssh_vendor_manager._cached_ssh_vendor
217
218
        orig_path = set_or_unset_env('PATH', '.')
218
219
        try:
219
220
            # No vendor defined yet, query for one
220
 
            ssh._ssh_vendor = None
 
221
            ssh._ssh_vendor_manager.clear_cache()
221
222
            vendor = ssh._get_ssh_vendor()
222
223
            self.assertIsInstance(vendor, ssh.ParamikoVendor)
223
224
        finally:
224
225
            set_or_unset_env('PATH', orig_path)
225
 
            ssh._ssh_vendor = orig_vendor
 
226
            ssh._ssh_vendor_manager._cached_ssh_vendor = orig_vendor
226
227
 
227
228
    def test_abspath_root_sibling_server(self):
228
229
        from bzrlib.transport.sftp import SFTPSiblingAbsoluteServer
346
347
        s.bind(('localhost', 0))
347
348
        self.bogus_url = 'sftp://%s:%s/' % s.getsockname()
348
349
 
349
 
        orig_vendor = bzrlib.transport.ssh._ssh_vendor
 
350
        orig_vendor = bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor
350
351
        def reset():
351
 
            bzrlib.transport.ssh._ssh_vendor = orig_vendor
 
352
            bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor = orig_vendor
352
353
            s.close()
353
354
        self.addCleanup(reset)
354
355
 
355
356
    def set_vendor(self, vendor):
356
357
        import bzrlib.transport.ssh
357
 
        bzrlib.transport.ssh._ssh_vendor = vendor
 
358
        bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor = vendor
358
359
 
359
360
    def test_bad_connection_paramiko(self):
360
361
        """Test that a real connection attempt raises the right error"""