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

Function TestSudoCommand

easyssh_test.go:487–501  ·  view source on GitHub ↗

TestSudoCommand

(t *testing.T)

Source from the content-addressed store, hash-verified

485
486// TestSudoCommand
487func TestSudoCommand(t *testing.T) {
488 ssh := &MakeConfig{
489 Server: "localhost",
490 User: "drone-scp",
491 Port: "22",
492 KeyPath: "./tests/.ssh/id_rsa",
493 RequestPty: true,
494 }
495
496 outStr, errStr, isTimeout, err := ssh.Run(`sudo su - -c "whoami"`)
497 assert.Equal(t, "root\r\n", outStr)
498 assert.Equal(t, "", errStr)
499 assert.True(t, isTimeout)
500 assert.NoError(t, err)
501}
502
503func TestCommandTimeout(t *testing.T) {
504 ssh := &MakeConfig{

Callers

nothing calls this directly

Calls 1

RunMethod · 0.95

Tested by

no test coverage detected