MCPcopy Create free account
hub / github.com/appleboy/easyssh-proxy / TestProxyClient

Function TestProxyClient

easyssh_test.go:276–352  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

274}
275
276func TestProxyClient(t *testing.T) {
277 ssh := &MakeConfig{
278 Server: "localhost",
279 User: "drone-scp",
280 Port: "22",
281 Password: "1234",
282 Proxy: DefaultConfig{
283 User: "drone-scp",
284 Server: "localhost",
285 Port: "22",
286 Password: "123456",
287 },
288 }
289
290 // password of proxy client is incorrect.
291 // can't connect proxy server
292 session, client, err := ssh.Connect()
293 assert.Nil(t, session)
294 assert.Nil(t, client)
295 assert.Error(t, err)
296
297 ssh = &MakeConfig{
298 Server: "www.che.ccu.edu.tw",
299 User: "drone-scp",
300 Port: "228",
301 Password: "123456",
302 Proxy: DefaultConfig{
303 User: "drone-scp",
304 Server: "localhost",
305 Port: "22",
306 KeyPath: "./tests/.ssh/id_rsa",
307 },
308 }
309
310 // proxy client can't dial to target server
311 session, client, err = ssh.Connect()
312 assert.Nil(t, session)
313 assert.Nil(t, client)
314 assert.Error(t, err)
315
316 ssh = &MakeConfig{
317 Server: "localhost",
318 User: "drone-scp",
319 Port: "22",
320 Password: "123456",
321 Proxy: DefaultConfig{
322 User: "drone-scp",
323 Server: "localhost",
324 Port: "22",
325 KeyPath: "./tests/.ssh/id_rsa",
326 },
327 }
328
329 // proxy client can't create new client connection of target
330 session, client, err = ssh.Connect()
331 assert.Nil(t, session)
332 assert.Nil(t, client)
333 assert.Error(t, err)

Callers

nothing calls this directly

Calls 1

ConnectMethod · 0.95

Tested by

no test coverage detected