diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-21 18:17:29 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-21 18:17:29 +0100 |
commit | cd435d9a72a866f8dcb5e64d4fd0d821b8569006 (patch) | |
tree | 2914236e3e680d92db9bb6278bdd12656c257a4a /plumbing/transport/ssh/auth_method_test.go | |
parent | e26a605c93d8085dfff8e440838fd3c43b63cff6 (diff) | |
download | go-git-cd435d9a72a866f8dcb5e64d4fd0d821b8569006.tar.gz |
plumbing/transport: git, error on empty SSH_AUTH_SOCK
Diffstat (limited to 'plumbing/transport/ssh/auth_method_test.go')
-rw-r--r-- | plumbing/transport/ssh/auth_method_test.go | 15 |
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) +} |