/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

(Dmitry Vasiliev) Support for Putty SSH, and improved vendor support

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
205
206
        """Test that if no 'ssh' is available we get builtin paramiko"""
206
207
        from bzrlib.transport import ssh
207
208
        # set '.' as the only location in the path, forcing no 'ssh' to exist
208
 
        orig_vendor = ssh._ssh_vendor
 
209
        orig_vendor = ssh._ssh_vendor_manager._cached_ssh_vendor
209
210
        orig_path = set_or_unset_env('PATH', '.')
210
211
        try:
211
212
            # No vendor defined yet, query for one
212
 
            ssh._ssh_vendor = None
 
213
            ssh._ssh_vendor_manager.clear_cache()
213
214
            vendor = ssh._get_ssh_vendor()
214
215
            self.assertIsInstance(vendor, ssh.ParamikoVendor)
215
216
        finally:
216
217
            set_or_unset_env('PATH', orig_path)
217
 
            ssh._ssh_vendor = orig_vendor
 
218
            ssh._ssh_vendor_manager._cached_ssh_vendor = orig_vendor
218
219
 
219
220
    def test_abspath_root_sibling_server(self):
220
221
        from bzrlib.transport.sftp import SFTPSiblingAbsoluteServer
338
339
        s.bind(('localhost', 0))
339
340
        self.bogus_url = 'sftp://%s:%s/' % s.getsockname()
340
341
 
341
 
        orig_vendor = bzrlib.transport.ssh._ssh_vendor
 
342
        orig_vendor = bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor
342
343
        def reset():
343
 
            bzrlib.transport.ssh._ssh_vendor = orig_vendor
 
344
            bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor = orig_vendor
344
345
            s.close()
345
346
        self.addCleanup(reset)
346
347
 
347
348
    def set_vendor(self, vendor):
348
349
        import bzrlib.transport.ssh
349
 
        bzrlib.transport.ssh._ssh_vendor = vendor
 
350
        bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor = vendor
350
351
 
351
352
    def test_bad_connection_paramiko(self):
352
353
        """Test that a real connection attempt raises the right error"""