~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ssh_transport.py

  • Committer: Martin von Gagern
  • Date: 2010-04-20 08:47:38 UTC
  • mfrom: (5167 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5195.
  • Revision ID: martin.vgagern@gmx.net-20100420084738-ygymnqmdllzrhpfn
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
from bzrlib.tests import TestCase
18
18
from bzrlib.errors import SSHVendorNotFound, UnknownSSH
76
76
        manager = TestSSHVendorManager()
77
77
        self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})
78
78
        manager.set_ssh_version_string("plink")
79
 
        self.assertIsInstance(manager.get_vendor({}), PLinkSubprocessVendor)
 
79
        # Auto-detect of plink vendor disabled, on Windows recommended
 
80
        # default ssh-client is paramiko
 
81
        # see https://bugs.launchpad.net/bugs/414743
 
82
        #~self.assertIsInstance(manager.get_vendor({}), PLinkSubprocessVendor)
 
83
        self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})
80
84
 
81
85
    def test_cached_vendor(self):
82
86
        manager = TestSSHVendorManager()
128
132
        # Last cached value always checked first
129
133
        self.assertIs(manager.get_vendor({}), vendor)
130
134
 
 
135
    def test_get_vendor_from_path_win32_plink(self):
 
136
        manager = TestSSHVendorManager()
 
137
        manager.set_ssh_version_string("plink: Release 0.60")
 
138
        plink_path = "C:/Program Files/PuTTY/plink.exe"
 
139
        vendor = manager.get_vendor({"BZR_SSH": plink_path})
 
140
        self.assertIsInstance(vendor, PLinkSubprocessVendor)
 
141
        args = vendor._get_vendor_specific_argv("user", "host", 22, ["bzr"])
 
142
        self.assertEqual(args[0], plink_path)
 
143
 
 
144
    def test_get_vendor_from_path_nix_openssh(self):
 
145
        manager = TestSSHVendorManager()
 
146
        manager.set_ssh_version_string(
 
147
            "OpenSSH_5.1p1 Debian-5, OpenSSL, 0.9.8g 19 Oct 2007")
 
148
        openssh_path = "/usr/bin/ssh"
 
149
        vendor = manager.get_vendor({"BZR_SSH": openssh_path})
 
150
        self.assertIsInstance(vendor, OpenSSHSubprocessVendor)
 
151
        args = vendor._get_vendor_specific_argv("user", "host", 22, ["bzr"])
 
152
        self.assertEqual(args[0], openssh_path)
 
153
 
131
154
 
132
155
class SubprocessVendorsTests(TestCase):
133
156