aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-11-05 19:08:20 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2015-11-05 20:55:46 +0100
commit6be0bc1233b1a31e749354f1d54104b49d5bf19b (patch)
treea9fd259944a42322050247ed6b5393150f2c4cb8 /repository_test.go
parenta80d56b21142096f458758405736f3d567c175f5 (diff)
downloadgo-git-6be0bc1233b1a31e749354f1d54104b49d5bf19b.tar.gz
clients: new AuthMethod and ConnectWithAuth
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/repository_test.go b/repository_test.go
index 7a480f1..421160d 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -2,6 +2,7 @@ package git
import (
. "gopkg.in/check.v1"
+ "gopkg.in/src-d/go-git.v2/clients/http"
"gopkg.in/src-d/go-git.v2/core"
)
@@ -9,8 +10,21 @@ type SuiteRepository struct{}
var _ = Suite(&SuiteRepository{})
+func (s *SuiteRepository) TestNewRepository(c *C) {
+ r, err := NewRepository(RepositoryFixture, nil)
+ c.Assert(err, IsNil)
+ c.Assert(r.Remotes["origin"].Auth, IsNil)
+}
+
+func (s *SuiteRepository) TestNewRepositoryWithAuth(c *C) {
+ auth := &http.BasicAuth{}
+ r, err := NewRepository(RepositoryFixture, auth)
+ c.Assert(err, IsNil)
+ c.Assert(r.Remotes["origin"].Auth, Equals, auth)
+}
+
func (s *SuiteRepository) TestPull(c *C) {
- r, err := NewRepository(RepositoryFixture)
+ r, err := NewRepository(RepositoryFixture, nil)
r.Remotes["origin"].upSrv = &MockGitUploadPackService{}
c.Assert(err, IsNil)
@@ -18,7 +32,7 @@ func (s *SuiteRepository) TestPull(c *C) {
}
func (s *SuiteRepository) TestCommit(c *C) {
- r, err := NewRepository(RepositoryFixture)
+ r, err := NewRepository(RepositoryFixture, nil)
r.Remotes["origin"].upSrv = &MockGitUploadPackService{}
c.Assert(err, IsNil)
@@ -34,7 +48,7 @@ func (s *SuiteRepository) TestCommit(c *C) {
}
func (s *SuiteRepository) TestCommits(c *C) {
- r, err := NewRepository(RepositoryFixture)
+ r, err := NewRepository(RepositoryFixture, nil)
r.Remotes["origin"].upSrv = &MockGitUploadPackService{}
c.Assert(err, IsNil)