@@ -218,6 +218,9 @@ def test_controlpath_token_expansion(self, getpass):
218
218
Host explicit_host
219
219
HostName ohai
220
220
ControlPath remoteuser %r host %h orighost %n
221
+
222
+ Host hashbrowns
223
+ ControlPath %C
221
224
"""
222
225
)
223
226
result = config .lookup ("explicit_user" )["controlpath" ]
@@ -226,6 +229,9 @@ def test_controlpath_token_expansion(self, getpass):
226
229
result = config .lookup ("explicit_host" )["controlpath" ]
227
230
# Remote user falls back to local user; host and orighost may differ
228
231
assert result == "remoteuser gandalf host ohai orighost explicit_host"
232
+ # Supports %C
233
+ result = config .lookup ("hashbrowns" )["controlpath" ]
234
+ assert result == "fc995d9f41ca1bcec7bc1d7f1ca87b9ff568a6d4"
229
235
230
236
def test_negation (self ):
231
237
config = SSHConfig .from_text (
@@ -280,7 +286,6 @@ def test_proxycommand(self):
280
286
def test_identityfile (self ):
281
287
config = SSHConfig .from_text (
282
288
"""
283
-
284
289
IdentityFile id_dsa0
285
290
286
291
Host *
@@ -291,6 +296,9 @@ def test_identityfile(self):
291
296
292
297
Host dsa2*
293
298
IdentityFile id_dsa22
299
+
300
+ Host hashbrowns
301
+ IdentityFile %C
294
302
"""
295
303
)
296
304
for host , values in {
@@ -303,8 +311,15 @@ def test_identityfile(self):
303
311
"hostname" : "dsa22" ,
304
312
"identityfile" : ["id_dsa0" , "id_dsa1" , "id_dsa22" ],
305
313
},
314
+ "hashbrowns" : {
315
+ "hostname" : "hashbrowns" ,
316
+ "identityfile" : [
317
+ "id_dsa0" ,
318
+ "id_dsa1" ,
319
+ "d5c0115d09912e39ff27844ea9d6052fc6048f99" ,
320
+ ],
321
+ },
306
322
}.items ():
307
-
308
323
assert config .lookup (host ) == values
309
324
310
325
def test_config_addressfamily_and_lazy_fqdn (self ):
@@ -740,10 +755,10 @@ def test_does_not_match_nonzero_exit_codes(self, run):
740
755
@patch ("paramiko.config.getpass" )
741
756
@patch ("paramiko.config.invoke.run" )
742
757
def test_tokenizes_argument (self , run , getpass , socket ):
743
- socket .gethostname .return_value = "local.fqdn"
744
758
getpass .getuser .return_value = "gandalf"
745
- # Actual exec value is "%d %h %L %l %n %p %r %u"
759
+ # Actual exec value is "%C % d %h %L %l %n %p %r %u"
746
760
parts = (
761
+ "bf5ba06778434a9384ee4217e462f64888bd0cd2" ,
747
762
expanduser ("~" ),
748
763
"configured" ,
749
764
"local" ,
0 commit comments