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.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/plumbing/transport/ssh/auth_method_test.go b/plumbing/transport/ssh/auth_method_test.go
index 412e721..43b34df 100644
--- a/plumbing/transport/ssh/auth_method_test.go
+++ b/plumbing/transport/ssh/auth_method_test.go
@@ -2,8 +2,11 @@ package ssh
import (
"fmt"
+ "io/ioutil"
"os"
+ "golang.org/x/crypto/ssh/testdata"
+
. "gopkg.in/check.v1"
)
@@ -104,3 +107,22 @@ func (s *SuiteCommon) TestNewSSHAgentAuth(c *C) {
c.Assert(k, IsNil)
c.Assert(err, Equals, ErrEmptySSHAgentAddr)
}
+
+func (*SuiteCommon) TestNewPublicKeys(c *C) {
+ auth, err := NewPublicKeys("foo", testdata.PEMBytes["rsa"])
+ c.Assert(err, IsNil)
+ c.Assert(auth, NotNil)
+}
+
+func (*SuiteCommon) TestNewPublicKeysFromFile(c *C) {
+ f, err := ioutil.TempFile("", "ssh-test")
+ c.Assert(err, IsNil)
+ _, err = f.Write(testdata.PEMBytes["rsa"])
+ c.Assert(err, IsNil)
+ c.Assert(f.Close(), IsNil)
+ defer os.RemoveAll(f.Name())
+
+ auth, err := NewPublicKeysFromFile("foo", f.Name())
+ c.Assert(err, IsNil)
+ c.Assert(auth, NotNil)
+}