aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/client/common_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 /plumbing/client/common_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 'plumbing/client/common_test.go')
-rw-r--r--plumbing/client/common_test.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/plumbing/client/common_test.go b/plumbing/client/common_test.go
deleted file mode 100644
index 058c4d3..0000000
--- a/plumbing/client/common_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package clients
-
-import (
- "fmt"
- "io"
- "testing"
-
- "gopkg.in/src-d/go-git.v4/plumbing/client/common"
-
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) { TestingT(t) }
-
-type SuiteCommon struct{}
-
-var _ = Suite(&SuiteCommon{})
-
-func (s *SuiteCommon) TestNewGitUploadPackServiceHTTP(c *C) {
- e, err := common.NewEndpoint("http://github.com/src-d/go-git")
- c.Assert(err, IsNil)
-
- output, err := NewGitUploadPackService(e)
- c.Assert(err, IsNil)
- c.Assert(typeAsString(output), Equals, "*http.GitUploadPackService")
-
- e, err = common.NewEndpoint("https://github.com/src-d/go-git")
- c.Assert(err, IsNil)
-
- output, err = NewGitUploadPackService(e)
- c.Assert(err, IsNil)
- c.Assert(typeAsString(output), Equals, "*http.GitUploadPackService")
-}
-
-func (s *SuiteCommon) TestNewGitUploadPackServiceSSH(c *C) {
- e, err := common.NewEndpoint("ssh://github.com/src-d/go-git")
- c.Assert(err, IsNil)
-
- output, err := NewGitUploadPackService(e)
- c.Assert(err, IsNil)
- c.Assert(typeAsString(output), Equals, "*ssh.GitUploadPackService")
-}
-
-func (s *SuiteCommon) TestNewGitUploadPackServiceUnknown(c *C) {
- e, err := common.NewEndpoint("unknown://github.com/src-d/go-git")
- c.Assert(err, IsNil)
-
- _, err = NewGitUploadPackService(e)
- c.Assert(err, NotNil)
-}
-
-func (s *SuiteCommon) TestInstallProtocol(c *C) {
- InstallProtocol("newscheme", newDummyProtocolService)
- c.Assert(Protocols["newscheme"], NotNil)
-}
-
-type dummyProtocolService struct{}
-
-func newDummyProtocolService(common.Endpoint) common.GitUploadPackService {
- return &dummyProtocolService{}
-}
-
-func (s *dummyProtocolService) Connect() error {
- return nil
-}
-
-func (s *dummyProtocolService) SetAuth(auth common.AuthMethod) error {
- return nil
-}
-
-func (s *dummyProtocolService) Info() (*common.GitUploadPackInfo, error) {
- return nil, nil
-}
-
-func (s *dummyProtocolService) Fetch(r *common.GitUploadPackRequest) (io.ReadCloser, error) {
- return nil, nil
-}
-
-func (s *dummyProtocolService) Disconnect() error {
- return nil
-}
-
-func typeAsString(v interface{}) string {
- return fmt.Sprintf("%T", v)
-}