| 1 |
package server_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"github.com/go-git/go-git/v5/plumbing/transport" |
| 5 |
|
| 6 |
. "gopkg.in/check.v1" |
| 7 |
) |
| 8 |
|
| 9 |
type UploadPackSuite struct { |
| 10 |
BaseSuite |
| 11 |
} |
| 12 |
|
| 13 |
var _ = Suite(&UploadPackSuite{}) |
| 14 |
|
| 15 |
func (s *UploadPackSuite) SetUpSuite(c *C) { |
| 16 |
s.BaseSuite.SetUpSuite(c) |
| 17 |
s.Client = s.client |
| 18 |
} |
| 19 |
|
| 20 |
func (s *UploadPackSuite) SetUpTest(c *C) { |
| 21 |
s.prepareRepositories(c) |
| 22 |
} |
| 23 |
|
| 24 |
// Overwritten, server returns error earlier. |
| 25 |
func (s *UploadPackSuite) TestAdvertisedReferencesNotExists(c *C) { |
| 26 |
r, err := s.Client.NewUploadPackSession(s.NonExistentEndpoint, s.EmptyAuth) |
| 27 |
c.Assert(err, Equals, transport.ErrRepositoryNotFound) |
| 28 |
c.Assert(r, IsNil) |
| 29 |
} |
| 30 |
|
| 31 |
func (s *UploadPackSuite) TestUploadPackWithContext(c *C) { |
| 32 |
c.Skip("UploadPack cannot be canceled on server") |
| 33 |
} |
| 34 |
|
| 35 |
// Tests server with `asClient = true`. This is recommended when using a server |
| 36 |
// registered directly with `client.InstallProtocol`. |
| 37 |
type ClientLikeUploadPackSuite struct { |
| 38 |
UploadPackSuite |
| 39 |
} |
| 40 |
|
| 41 |
var _ = Suite(&ClientLikeUploadPackSuite{}) |
| 42 |
|
| 43 |
func (s *ClientLikeUploadPackSuite) SetUpSuite(c *C) { |
| 44 |
s.asClient = true |
| 45 |
s.UploadPackSuite.SetUpSuite(c) |
| 46 |
} |
| 47 |
|
| 48 |
func (s *ClientLikeUploadPackSuite) TestAdvertisedReferencesEmpty(c *C) { |
| 49 |
s.UploadPackSuite.TestAdvertisedReferencesEmpty(c) |
| 50 |
} |