aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-11-23 15:30:34 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-11-23 15:38:12 +0100
commit08e08d771ef03df80248c80d81475fe7c5ea6fe7 (patch)
treed12e9befa22409e8cf50c5bbc4895e69fd8a5f48 /remote_test.go
parent844169a739fb8bf1f252d416f10d8c7034db9fe2 (diff)
downloadgo-git-08e08d771ef03df80248c80d81475fe7c5ea6fe7.tar.gz
transport: create Client interface (#132)
* plumbing: move plumbing/client package to plumbing/transport. * transport: create Client interface. * A Client can instantiate any client transport service. * InstallProtocol installs a Client for a given protocol, instead of just a UploadPackService. * A Client can open a session for fetch-pack or send-pack for a specific Endpoint. * Adapt ssh and http clients to the new client interface. * updated doc
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/remote_test.go b/remote_test.go
index bfda15d..4df8767 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -11,9 +11,9 @@ import (
"gopkg.in/src-d/go-git.v4/config"
"gopkg.in/src-d/go-git.v4/plumbing"
- "gopkg.in/src-d/go-git.v4/plumbing/client"
- githttp "gopkg.in/src-d/go-git.v4/plumbing/client/http"
"gopkg.in/src-d/go-git.v4/plumbing/storer"
+ "gopkg.in/src-d/go-git.v4/plumbing/transport/client"
+ githttp "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
"gopkg.in/src-d/go-git.v4/storage/memory"
osfs "gopkg.in/src-d/go-git.v4/utils/fs/os"
@@ -52,7 +52,7 @@ func (s *RemoteSuite) TestnewRemoteInvalidSchemaEndpoint(c *C) {
func (s *RemoteSuite) TestInfo(c *C) {
r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
c.Assert(r.Info(), IsNil)
c.Assert(r.Connect(), IsNil)
@@ -62,7 +62,7 @@ func (s *RemoteSuite) TestInfo(c *C) {
func (s *RemoteSuite) TestDefaultBranch(c *C) {
r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
c.Assert(r.Connect(), IsNil)
c.Assert(r.Head().Name(), Equals, plumbing.ReferenceName("refs/heads/master"))
@@ -70,7 +70,7 @@ func (s *RemoteSuite) TestDefaultBranch(c *C) {
func (s *RemoteSuite) TestCapabilities(c *C) {
r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
c.Assert(r.Connect(), IsNil)
c.Assert(r.Capabilities().Get("agent").Values, HasLen, 1)
@@ -79,7 +79,7 @@ func (s *RemoteSuite) TestCapabilities(c *C) {
func (s *RemoteSuite) TestFetch(c *C) {
sto := memory.NewStorage()
r := newRemote(sto, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
c.Assert(r.Connect(), IsNil)
@@ -124,7 +124,7 @@ func (s *RemoteSuite) TestFetchWithPackfileWriter(c *C) {
mock := &mockPackfileWriter{Storer: fss}
r := newRemote(mock, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
c.Assert(r.Connect(), IsNil)
@@ -150,7 +150,7 @@ func (s *RemoteSuite) TestFetchWithPackfileWriter(c *C) {
func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDate(c *C) {
sto := memory.NewStorage()
r := newRemote(sto, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
c.Assert(r.Connect(), IsNil)
@@ -166,7 +166,7 @@ func (s *RemoteSuite) TestFetchNoErrAlreadyUpToDate(c *C) {
func (s *RemoteSuite) TestHead(c *C) {
r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
err := r.Connect()
c.Assert(err, IsNil)
@@ -175,7 +175,7 @@ func (s *RemoteSuite) TestHead(c *C) {
func (s *RemoteSuite) TestRef(c *C) {
r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
err := r.Connect()
c.Assert(err, IsNil)
@@ -191,7 +191,7 @@ func (s *RemoteSuite) TestRef(c *C) {
func (s *RemoteSuite) TestRefs(c *C) {
r := newRemote(nil, &config.RemoteConfig{Name: "foo", URL: RepositoryFixture})
- r.upSrv = &MockGitUploadPackService{}
+ r.client = &MockClient{}
err := r.Connect()
c.Assert(err, IsNil)
@@ -225,9 +225,9 @@ func Example_customHTTPClient() {
}
// Override http(s) default protocol to use our custom client
- clients.InstallProtocol(
+ client.InstallProtocol(
"https",
- githttp.NewGitUploadPackServiceFactory(customClient))
+ githttp.NewClient(customClient))
// Create an in-memory repository
r := NewMemoryRepository()