From ced1b81e32f971a80e474e9661b9c1b9c96569e7 Mon Sep 17 00:00:00 2001 From: nodivbyzero Date: Wed, 13 Dec 2023 17:08:33 -0800 Subject: plumbing: check setAuth error. Fixes #185 --- plumbing/transport/ssh/common_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'plumbing/transport/ssh/common_test.go') diff --git a/plumbing/transport/ssh/common_test.go b/plumbing/transport/ssh/common_test.go index 4cc2a06..a724936 100644 --- a/plumbing/transport/ssh/common_test.go +++ b/plumbing/transport/ssh/common_test.go @@ -206,3 +206,26 @@ func (c *mockSSHConfig) Get(alias, key string) string { return a[key] } + +type invalidAuthMethod struct { +} + +func (a *invalidAuthMethod) Name() string { + return "invalid" +} + +func (a *invalidAuthMethod) String() string { + return "invalid" +} + +func (s *SuiteCommon) TestCommandWithInvalidAuthMethod(c *C) { + uploadPack := &UploadPackSuite{} + uploadPack.SetUpSuite(c) + r := &runner{} + auth := &invalidAuthMethod{} + + _, err := r.Command("command", uploadPack.newEndpoint(c, "endpoint"), auth) + + c.Assert(err, NotNil) + c.Assert(err, ErrorMatches, "invalid auth method") +} -- cgit