diff options
author | Santiago M. Mola <santi@mola.io> | 2016-11-25 09:25:49 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-25 09:25:49 +0100 |
commit | 9e34f68d980de57631c588aaa910c9ea95ed7c2e (patch) | |
tree | b1bd9f867b757ca46ada2f349d122723dde3529c /plumbing/transport/http/common_test.go | |
parent | 8966c042795509ed17730e50d352ad69901c3da8 (diff) | |
download | go-git-9e34f68d980de57631c588aaa910c9ea95ed7c2e.tar.gz |
plumbing/transport: add common tests and fixes. (#136)
* plumbing/transport: add common tests and fixes.
* add common test suite for different transport implementations.
* fix different behaviour on error handling for ssh and http.
fixes issue #123.
* support detecting unexisting repositories with SSH + GitHub/Bitbucket
(apparently, there is no standard for all SSH servers).
* remove ssh.NewClient (only DefaultClient makes sense at the moment).
* make ssh.Client and http.Client private.
* utils/ioutil: utilities to work with io interfaces.
* * transport: test actual objects fetched, not just packfile size.
* * fix doc typo.
* * improve UploadPackRequest.IsEmpty
Diffstat (limited to 'plumbing/transport/http/common_test.go')
-rw-r--r-- | plumbing/transport/http/common_test.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/plumbing/transport/http/common_test.go b/plumbing/transport/http/common_test.go index 1d09fba..432bd07 100644 --- a/plumbing/transport/http/common_test.go +++ b/plumbing/transport/http/common_test.go @@ -20,16 +20,20 @@ var _ = Suite(&ClientSuite{}) func (s *ClientSuite) SetUpSuite(c *C) { var err error - s.Endpoint, err = transport.NewEndpoint("https://github.com/git-fixtures/basic") + s.Endpoint, err = transport.NewEndpoint( + "https://github.com/git-fixtures/basic", + ) c.Assert(err, IsNil) } func (s *FetchPackSuite) TestNewClient(c *C) { - roundTripper := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}} - client := &http.Client{Transport: roundTripper} - r := NewClient(client).(*Client) - - c.Assert(r.c, Equals, client) + roundTripper := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + cl := &http.Client{Transport: roundTripper} + r, ok := NewClient(cl).(*client) + c.Assert(ok, Equals, true) + c.Assert(r.c, Equals, cl) } func (s *ClientSuite) TestNewBasicAuth(c *C) { @@ -54,7 +58,8 @@ func (s *ClientSuite) TestNewErrNotFound(c *C) { } func (s *ClientSuite) TestNewHTTPError40x(c *C) { - s.testNewHTTPError(c, http.StatusPaymentRequired, "unexpected client error.*") + s.testNewHTTPError(c, http.StatusPaymentRequired, + "unexpected client error.*") } func (s *ClientSuite) testNewHTTPError(c *C, code int, msg string) { |