예제 #1
0
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")
}
예제 #2
0
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)
}
예제 #3
0
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)
}
예제 #4
0
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)
}
예제 #5
0
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:*******")
}
예제 #6
0
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")
	}
}
예제 #7
0
파일: proxy.go 프로젝트: mcuadros/gop.kg
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
}
예제 #8
0
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)
}
예제 #9
0
파일: remote.go 프로젝트: alcortesm/go-git
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()
}
예제 #10
0
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)
}
예제 #11
0
func (s *RemoteSuite) SetUpSuite(c *C) {
	var err error
	s.Endpoint, err = common.NewEndpoint("https://github.com/git-fixtures/basic")
	c.Assert(err, IsNil)
}