aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/ssh/auth_method_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/transport/ssh/auth_method_test.go')
-rw-r--r--plumbing/transport/ssh/auth_method_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/plumbing/transport/ssh/auth_method_test.go b/plumbing/transport/ssh/auth_method_test.go
index f9e7dec..412e721 100644
--- a/plumbing/transport/ssh/auth_method_test.go
+++ b/plumbing/transport/ssh/auth_method_test.go
@@ -2,6 +2,7 @@ package ssh
import (
"fmt"
+ "os"
. "gopkg.in/check.v1"
)
@@ -89,3 +90,17 @@ func (s *SuiteCommon) TestPublicKeysCallbackString(c *C) {
}
c.Assert(a.String(), Equals, fmt.Sprintf("user: test, name: %s", PublicKeysCallbackName))
}
+func (s *SuiteCommon) TestNewSSHAgentAuth(c *C) {
+ addr := os.Getenv("SSH_AUTH_SOCK")
+ err := os.Unsetenv("SSH_AUTH_SOCK")
+ c.Assert(err, IsNil)
+
+ defer func() {
+ err := os.Setenv("SSH_AUTH_SOCK", addr)
+ c.Assert(err, IsNil)
+ }()
+
+ k, err := NewSSHAgentAuth("foo")
+ c.Assert(k, IsNil)
+ c.Assert(err, Equals, ErrEmptySSHAgentAddr)
+}