diff options
author | Anthony Weems <amlweems@gmail.com> | 2017-01-17 11:17:11 -0600 |
---|---|---|
committer | Santiago M. Mola <santi@mola.io> | 2017-01-17 18:17:11 +0100 |
commit | 6593c757346f9817a770ff0ea091cce3e8243070 (patch) | |
tree | 6fbb72583931b0386e382177970650a9cdbca4eb /plumbing/transport/test | |
parent | 241e8ba00ac9533299d62dc38684305af2b6c301 (diff) | |
download | go-git-6593c757346f9817a770ff0ea091cce3e8243070.tar.gz |
transport: remove SetAuth, fixes #206 (#210)
* remove SetAuth functions, implement at NewUploadPackSession/NewReceivePackSession level.
* propagate transport.Auth from Fetch/Pull/Clone options to the transport API.
Diffstat (limited to 'plumbing/transport/test')
-rw-r--r-- | plumbing/transport/test/receive_pack.go | 21 | ||||
-rw-r--r-- | plumbing/transport/test/upload_pack.go | 27 |
2 files changed, 25 insertions, 23 deletions
diff --git a/plumbing/transport/test/receive_pack.go b/plumbing/transport/test/receive_pack.go index e798154..107e733 100644 --- a/plumbing/transport/test/receive_pack.go +++ b/plumbing/transport/test/receive_pack.go @@ -23,11 +23,12 @@ type ReceivePackSuite struct { Endpoint transport.Endpoint EmptyEndpoint transport.Endpoint NonExistentEndpoint transport.Endpoint + EmptyAuth transport.AuthMethod Client transport.Transport } func (s *ReceivePackSuite) TestAdvertisedReferencesEmpty(c *C) { - r, err := s.Client.NewReceivePackSession(s.EmptyEndpoint) + r, err := s.Client.NewReceivePackSession(s.EmptyEndpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() ar, err := r.AdvertisedReferences() @@ -36,14 +37,14 @@ func (s *ReceivePackSuite) TestAdvertisedReferencesEmpty(c *C) { } func (s *ReceivePackSuite) TestAdvertisedReferencesNotExists(c *C) { - r, err := s.Client.NewReceivePackSession(s.NonExistentEndpoint) + r, err := s.Client.NewReceivePackSession(s.NonExistentEndpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() ar, err := r.AdvertisedReferences() c.Assert(err, Equals, transport.ErrRepositoryNotFound) c.Assert(ar, IsNil) - r, err = s.Client.NewReceivePackSession(s.NonExistentEndpoint) + r, err = s.Client.NewReceivePackSession(s.NonExistentEndpoint, s.EmptyAuth) c.Assert(err, IsNil) req := packp.NewReferenceUpdateRequest() req.Commands = []*packp.Command{ @@ -56,7 +57,7 @@ func (s *ReceivePackSuite) TestAdvertisedReferencesNotExists(c *C) { } func (s *ReceivePackSuite) TestCallAdvertisedReferenceTwice(c *C) { - r, err := s.Client.NewReceivePackSession(s.Endpoint) + r, err := s.Client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) ar1, err := r.AdvertisedReferences() c.Assert(err, IsNil) @@ -67,7 +68,7 @@ func (s *ReceivePackSuite) TestCallAdvertisedReferenceTwice(c *C) { } func (s *ReceivePackSuite) TestDefaultBranch(c *C) { - r, err := s.Client.NewReceivePackSession(s.Endpoint) + r, err := s.Client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -79,7 +80,7 @@ func (s *ReceivePackSuite) TestDefaultBranch(c *C) { } func (s *ReceivePackSuite) TestCapabilities(c *C) { - r, err := s.Client.NewReceivePackSession(s.Endpoint) + r, err := s.Client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -196,7 +197,7 @@ func (s *ReceivePackSuite) receivePackNoCheck(c *C, ep transport.Endpoint, ep.String(), url, callAdvertisedReferences, ) - r, err := s.Client.NewReceivePackSession(ep) + r, err := s.Client.NewReceivePackSession(ep, s.EmptyAuth) c.Assert(err, IsNil, comment) defer func() { c.Assert(r.Close(), IsNil, comment) }() @@ -247,7 +248,7 @@ func (s *ReceivePackSuite) checkRemoteHead(c *C, ep transport.Endpoint, head plu func (s *ReceivePackSuite) checkRemoteReference(c *C, ep transport.Endpoint, refName string, head plumbing.Hash) { - r, err := s.Client.NewUploadPackSession(ep) + r, err := s.Client.NewUploadPackSession(ep, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() ar, err := r.AdvertisedReferences() @@ -267,7 +268,7 @@ func (s *ReceivePackSuite) TestSendPackAddDeleteReference(c *C) { } func (s *ReceivePackSuite) testSendPackAddReference(c *C) { - r, err := s.Client.NewReceivePackSession(s.Endpoint) + r, err := s.Client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -289,7 +290,7 @@ func (s *ReceivePackSuite) testSendPackAddReference(c *C) { } func (s *ReceivePackSuite) testSendPackDeleteReference(c *C) { - r, err := s.Client.NewReceivePackSession(s.Endpoint) + r, err := s.Client.NewReceivePackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() diff --git a/plumbing/transport/test/upload_pack.go b/plumbing/transport/test/upload_pack.go index 5af4b29..c1a9050 100644 --- a/plumbing/transport/test/upload_pack.go +++ b/plumbing/transport/test/upload_pack.go @@ -22,11 +22,12 @@ type UploadPackSuite struct { Endpoint transport.Endpoint EmptyEndpoint transport.Endpoint NonExistentEndpoint transport.Endpoint + EmptyAuth transport.AuthMethod Client transport.Transport } func (s *UploadPackSuite) TestAdvertisedReferencesEmpty(c *C) { - r, err := s.Client.NewUploadPackSession(s.EmptyEndpoint) + r, err := s.Client.NewUploadPackSession(s.EmptyEndpoint, s.EmptyAuth) c.Assert(err, IsNil) ar, err := r.AdvertisedReferences() c.Assert(err, Equals, transport.ErrEmptyRemoteRepository) @@ -34,13 +35,13 @@ func (s *UploadPackSuite) TestAdvertisedReferencesEmpty(c *C) { } func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) { - r, err := s.Client.NewUploadPackSession(s.NonExistentEndpoint) + r, err := s.Client.NewUploadPackSession(s.NonExistentEndpoint, s.EmptyAuth) c.Assert(err, IsNil) ar, err := r.AdvertisedReferences() c.Assert(err, Equals, transport.ErrRepositoryNotFound) c.Assert(ar, IsNil) - r, err = s.Client.NewUploadPackSession(s.NonExistentEndpoint) + r, err = s.Client.NewUploadPackSession(s.NonExistentEndpoint, s.EmptyAuth) c.Assert(err, IsNil) req := packp.NewUploadPackRequest() req.Wants = append(req.Wants, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")) @@ -50,7 +51,7 @@ func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) { } func (s *UploadPackSuite) TestCallAdvertisedReferenceTwice(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) ar1, err := r.AdvertisedReferences() c.Assert(err, IsNil) @@ -61,7 +62,7 @@ func (s *UploadPackSuite) TestCallAdvertisedReferenceTwice(c *C) { } func (s *UploadPackSuite) TestDefaultBranch(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -73,7 +74,7 @@ func (s *UploadPackSuite) TestDefaultBranch(c *C) { } func (s *UploadPackSuite) TestAdvertisedReferencesFilterUnsupported(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -83,7 +84,7 @@ func (s *UploadPackSuite) TestAdvertisedReferencesFilterUnsupported(c *C) { } func (s *UploadPackSuite) TestCapabilities(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -93,7 +94,7 @@ func (s *UploadPackSuite) TestCapabilities(c *C) { } func (s *UploadPackSuite) TestFullUploadPack(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -111,7 +112,7 @@ func (s *UploadPackSuite) TestFullUploadPack(c *C) { } func (s *UploadPackSuite) TestUploadPack(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -125,7 +126,7 @@ func (s *UploadPackSuite) TestUploadPack(c *C) { } func (s *UploadPackSuite) TestUploadPackInvalidReq(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -139,7 +140,7 @@ func (s *UploadPackSuite) TestUploadPackInvalidReq(c *C) { } func (s *UploadPackSuite) TestUploadPackNoChanges(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -153,7 +154,7 @@ func (s *UploadPackSuite) TestUploadPackNoChanges(c *C) { } func (s *UploadPackSuite) TestUploadPackMulti(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) defer func() { c.Assert(r.Close(), IsNil) }() @@ -168,7 +169,7 @@ func (s *UploadPackSuite) TestUploadPackMulti(c *C) { } func (s *UploadPackSuite) TestFetchError(c *C) { - r, err := s.Client.NewUploadPackSession(s.Endpoint) + r, err := s.Client.NewUploadPackSession(s.Endpoint, s.EmptyAuth) c.Assert(err, IsNil) req := packp.NewUploadPackRequest() |