aboutsummaryrefslogtreecommitdiffstats
path: root/clients/http/git_upload_pack_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-13 20:07:21 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-13 20:07:21 +0200
commita65bcbc63bef24cf219c63d1b8cfb309c95d1c0f (patch)
tree973644feaf08adc916dab8fb95d1f6c86194c9c1 /clients/http/git_upload_pack_test.go
parenta6ea9e8dd2eda48c8405f609e0fb444d3717af53 (diff)
downloadgo-git-a65bcbc63bef24cf219c63d1b8cfb309c95d1c0f.tar.gz
clients: new Endpoint implementation and InstallProtocol function
Diffstat (limited to 'clients/http/git_upload_pack_test.go')
-rw-r--r--clients/http/git_upload_pack_test.go49
1 files changed, 27 insertions, 22 deletions
diff --git a/clients/http/git_upload_pack_test.go b/clients/http/git_upload_pack_test.go
index db4a273..7e8cc36 100644
--- a/clients/http/git_upload_pack_test.go
+++ b/clients/http/git_upload_pack_test.go
@@ -8,22 +8,27 @@ import (
"gopkg.in/src-d/go-git.v4/core"
)
-type SuiteRemote struct{}
+type RemoteSuite struct {
+ Endpoint common.Endpoint
+}
-var _ = Suite(&SuiteRemote{})
+var _ = Suite(&RemoteSuite{})
-const RepositoryFixture = "https://github.com/tyba/git-fixture"
+func (s *RemoteSuite) SetUpSuite(c *C) {
+ var err error
+ s.Endpoint, err = common.NewEndpoint("https://github.com/tyba/git-fixture")
+ c.Assert(err, IsNil)
+}
-func (s *SuiteRemote) TestConnect(c *C) {
- r := NewGitUploadPackService()
- c.Assert(r.Connect(RepositoryFixture), IsNil)
+func (s *RemoteSuite) TestConnect(c *C) {
+ r := NewGitUploadPackService(s.Endpoint)
+ c.Assert(r.Connect(), IsNil)
}
-func (s *SuiteRemote) TestConnectWithAuth(c *C) {
+func (s *RemoteSuite) TestConnectWithAuth(c *C) {
auth := &BasicAuth{}
- r := NewGitUploadPackService()
- c.Assert(r.ConnectWithAuth(RepositoryFixture, auth), IsNil)
- c.Assert(r.auth, Equals, auth)
+ r := NewGitUploadPackService(s.Endpoint)
+ c.Assert(r.ConnectWithAuth(auth), IsNil)
}
type mockAuth struct{}
@@ -31,32 +36,32 @@ type mockAuth struct{}
func (*mockAuth) Name() string { return "" }
func (*mockAuth) String() string { return "" }
-func (s *SuiteRemote) TestConnectWithAuthWrongType(c *C) {
- r := NewGitUploadPackService()
- c.Assert(r.ConnectWithAuth(RepositoryFixture, &mockAuth{}), Equals, InvalidAuthMethodErr)
+func (s *RemoteSuite) TestConnectWithAuthWrongType(c *C) {
+ r := NewGitUploadPackService(s.Endpoint)
+ c.Assert(r.ConnectWithAuth(&mockAuth{}), Equals, common.ErrInvalidAuthMethod)
}
-func (s *SuiteRemote) TestDefaultBranch(c *C) {
- r := NewGitUploadPackService()
- c.Assert(r.Connect(RepositoryFixture), IsNil)
+func (s *RemoteSuite) TestDefaultBranch(c *C) {
+ r := NewGitUploadPackService(s.Endpoint)
+ c.Assert(r.Connect(), IsNil)
info, err := r.Info()
c.Assert(err, IsNil)
c.Assert(info.Capabilities.SymbolicReference("HEAD"), Equals, "refs/heads/master")
}
-func (s *SuiteRemote) TestCapabilities(c *C) {
- r := NewGitUploadPackService()
- c.Assert(r.Connect(RepositoryFixture), IsNil)
+func (s *RemoteSuite) TestCapabilities(c *C) {
+ r := NewGitUploadPackService(s.Endpoint)
+ c.Assert(r.Connect(), IsNil)
info, err := r.Info()
c.Assert(err, IsNil)
c.Assert(info.Capabilities.Get("agent").Values, HasLen, 1)
}
-func (s *SuiteRemote) TestFetch(c *C) {
- r := NewGitUploadPackService()
- c.Assert(r.Connect(RepositoryFixture), IsNil)
+func (s *RemoteSuite) TestFetch(c *C) {
+ r := NewGitUploadPackService(s.Endpoint)
+ c.Assert(r.Connect(), IsNil)
req := &common.GitUploadPackRequest{}
req.Want(core.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"))