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) 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 *RemoteSuite) TestInfoNotExists(c *C) { endpoint, _ := common.NewEndpoint("https://github.com/git-fixture/not-exists") r := NewGitUploadPackService(endpoint) c.Assert(r.Connect(), IsNil) info, err := r.Info() c.Assert(err, Equals, common.ErrAuthorizationRequired) c.Assert(info, IsNil) }
func (s *FetcherSuite) TestVersions(c *C) { pkg := &Package{} pkg.Repository, _ = common.NewEndpoint("https://github.com/git-fixtures/basic") f := NewFetcher(pkg, nil) versions, err := f.Versions() c.Assert(err, IsNil) c.Assert(versions, HasLen, 2) }
func (s *RemoteSuite) TestNewGitUploadPackServiceAuth(c *C) { e, err := common.NewEndpoint("https://*****:*****@github.com/git-fixtures/basic") c.Assert(err, IsNil) r := NewGitUploadPackService(e) auth := r.(*GitUploadPackService).auth c.Assert(auth.String(), Equals, "http-basic-auth - foo:*******") }
func (s *RemoteSuite) SetUpSuite(c *C) { var err error s.Endpoint, err = common.NewEndpoint("[email protected]:git-fixtures/basic.git") c.Assert(err, IsNil) if os.Getenv("SSH_AUTH_SOCK") == "" { c.Skip("SSH_AUTH_SOCK is not set") } }
func (s *Server) buildEndpoint(server, orgnization, repository string) common.Endpoint { e, err := common.NewEndpoint(fmt.Sprintf( "https://%s/%s/%s", server, orgnization, repository, )) if err != nil { panic(fmt.Sprintf("unreachable: %s", err.Error())) } return e }
func (s *RemoteSuite) TestNewGitUploadPackServiceFactory(c *C) { e, err := common.NewEndpoint("https://*****:*****@github.com/git-fixtures/basic") c.Assert(err, IsNil) roundTripper := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}} client := &http.Client{Transport: roundTripper} r := NewGitUploadPackServiceFactory(client)(e).(*GitUploadPackService) c.Assert(r.auth.String(), Equals, "http-basic-auth - foo:*******") c.Assert(r.client.Transport, Equals, roundTripper) }
func (r *Remote) connectUploadPackService() error { endpoint, err := common.NewEndpoint(r.c.URL) if err != nil { return err } r.upSrv, err = clients.NewGitUploadPackService(endpoint) if err != nil { return err } return r.upSrv.Connect() }
func (s *FetcherSuite) TestFetch(c *C) { pkg := &Package{} pkg.Repository, _ = common.NewEndpoint("https://github.com/git-fixtures/basic") f := NewFetcher(pkg, nil) ref := plumbing.NewReferenceFromStrings("foo", "6ecf0ef2c2dffb796033e5a02219af86ec6584e5") buf := bytes.NewBuffer(nil) n, err := f.Fetch(buf, ref) c.Assert(err, IsNil) c.Assert(n, Equals, int64(85374)) c.Assert(buf.Len(), Equals, 85374) }
func (s *RemoteSuite) SetUpSuite(c *C) { var err error s.Endpoint, err = common.NewEndpoint("https://github.com/git-fixtures/basic") c.Assert(err, IsNil) }