MCPcopy
hub / github.com/git-lfs/git-lfs / TestSSHGetExeAndArgsPlinkCustomPortExplicitEnvironment

Function TestSSHGetExeAndArgsPlinkCustomPortExplicitEnvironment

ssh/ssh_test.go:171–189  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func TestSSHGetExeAndArgsPlinkCustomPortExplicitEnvironment(t *testing.T) {
172 plink := filepath.Join("Users", "joebloggs", "bin", "ssh")
173
174 cli, err := lfshttp.NewClient(lfshttp.NewContext(nil, map[string]string{
175 "GIT_SSH_COMMAND": "",
176 "GIT_SSH": plink,
177 "GIT_SSH_VARIANT": "plink",
178 }, nil))
179 require.Nil(t, err)
180
181 meta := ssh.SSHMetadata{}
182 meta.UserAndHost = "user@foo.com"
183 meta.Port = "8888"
184
185 exe, args, needShell, _, _ := ssh.GetExeAndArgs(cli.OSEnv(), cli.GitEnv(), &meta, false, "")
186 exe, args = ssh.FormatArgs(exe, args, needShell)
187 assert.Equal(t, plink, exe)
188 assert.Equal(t, []string{"-P", "8888", "user@foo.com"}, args)
189}
190
191func TestSSHGetExeAndArgsPlinkCustomPortExplicitEnvironmentPutty(t *testing.T) {
192 plink := filepath.Join("Users", "joebloggs", "bin", "ssh")

Callers

nothing calls this directly

Calls 7

OSEnvMethod · 0.95
GitEnvMethod · 0.95
NewClientFunction · 0.92
NewContextFunction · 0.92
GetExeAndArgsFunction · 0.92
FormatArgsFunction · 0.92
EqualMethod · 0.45

Tested by

no test coverage detected