/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 breezy/tests/test_ssh_transport.py

  • Committer: Jelmer Vernooij
  • Date: 2018-04-02 00:52:27 UTC
  • mfrom: (6939 work)
  • mto: This revision was merged to the branch mainline in revision 7274.
  • Revision ID: jelmer@jelmer.uk-20180402005227-pecflp1mvdjrjqd6
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    SSHCorpSubprocessVendor,
23
23
    LSHSubprocessVendor,
24
24
    SSHVendorManager,
 
25
    StrangeHostname,
25
26
    )
26
27
 
27
28
 
161
162
 
162
163
class SubprocessVendorsTests(TestCase):
163
164
 
 
165
    def test_openssh_command_tricked(self):
 
166
        vendor = OpenSSHSubprocessVendor()
 
167
        self.assertEqual(
 
168
            vendor._get_vendor_specific_argv(
 
169
                "user", "-oProxyCommand=blah", 100, command=["bzr"]),
 
170
            ["ssh", "-oForwardX11=no", "-oForwardAgent=no",
 
171
                "-oClearAllForwardings=yes",
 
172
                "-oNoHostAuthenticationForLocalhost=yes",
 
173
                "-p", "100",
 
174
                "-l", "user",
 
175
                "--",
 
176
                "-oProxyCommand=blah", "bzr"])
 
177
 
164
178
    def test_openssh_command_arguments(self):
165
179
        vendor = OpenSSHSubprocessVendor()
166
180
        self.assertEqual(
171
185
                "-oNoHostAuthenticationForLocalhost=yes",
172
186
                "-p", "100",
173
187
                "-l", "user",
 
188
                "--",
174
189
                "host", "bzr"]
175
190
            )
176
191
 
184
199
                "-oNoHostAuthenticationForLocalhost=yes",
185
200
                "-p", "100",
186
201
                "-l", "user",
187
 
                "-s", "host", "sftp"]
 
202
                "-s", "--", "host", "sftp"]
188
203
            )
189
204
 
 
205
    def test_openssh_command_tricked(self):
 
206
        vendor = SSHCorpSubprocessVendor()
 
207
        self.assertRaises(
 
208
            StrangeHostname,
 
209
            vendor._get_vendor_specific_argv,
 
210
                "user", "-oProxyCommand=host", 100, command=["bzr"])
 
211
 
190
212
    def test_sshcorp_command_arguments(self):
191
213
        vendor = SSHCorpSubprocessVendor()
192
214
        self.assertEqual(
209
231
                "-s", "sftp", "host"]
210
232
            )
211
233
 
 
234
    def test_lsh_command_tricked(self):
 
235
        vendor = LSHSubprocessVendor()
 
236
        self.assertRaises(
 
237
            StrangeHostname,
 
238
            vendor._get_vendor_specific_argv,
 
239
                "user", "-oProxyCommand=host", 100, command=["bzr"])
 
240
 
212
241
    def test_lsh_command_arguments(self):
213
242
        vendor = LSHSubprocessVendor()
214
243
        self.assertEqual(
231
260
                "--subsystem", "sftp", "host"]
232
261
            )
233
262
 
 
263
    def test_plink_command_tricked(self):
 
264
        vendor = PLinkSubprocessVendor()
 
265
        self.assertRaises(
 
266
            StrangeHostname,
 
267
            vendor._get_vendor_specific_argv,
 
268
                "user", "-oProxyCommand=host", 100, command=["bzr"])
 
269
 
234
270
    def test_plink_command_arguments(self):
235
271
        vendor = PLinkSubprocessVendor()
236
272
        self.assertEqual(