diff options
Diffstat (limited to 'common_test.go')
-rw-r--r-- | common_test.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/common_test.go b/common_test.go index 980c191..032fdfa 100644 --- a/common_test.go +++ b/common_test.go @@ -7,6 +7,7 @@ import ( "gopkg.in/src-d/go-git.v4/fixtures" "gopkg.in/src-d/go-git.v4/plumbing/format/packfile" "gopkg.in/src-d/go-git.v4/plumbing/storer" + "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/plumbing/transport/client" . "gopkg.in/check.v1" @@ -19,17 +20,23 @@ type BaseSuite struct { Repository *Repository Storer storer.EncodedObjectStorer - cache map[string]*Repository + backupProtocol transport.Transport + cache map[string]*Repository } func (s *BaseSuite) SetUpSuite(c *C) { s.Suite.SetUpSuite(c) - s.installMockProtocol(c) + s.installMockProtocol() s.buildBasicRepository(c) s.cache = make(map[string]*Repository, 0) } +func (s *BaseSuite) TearDownSuite(c *C) { + s.Suite.TearDownSuite(c) + s.uninstallMockProtocol() +} + func (s *BaseSuite) buildBasicRepository(c *C) { f := fixtures.Basic().One() s.Repository = s.NewRepository(f) @@ -71,10 +78,15 @@ func (s *BaseSuite) NewRepositoryFromPackfile(f *fixtures.Fixture) *Repository { return r } -func (s *BaseSuite) installMockProtocol(c *C) { +func (s *BaseSuite) installMockProtocol() { + s.backupProtocol = client.Protocols["https"] client.InstallProtocol("https", nil) } +func (s *BaseSuite) uninstallMockProtocol() { + client.InstallProtocol("https", s.backupProtocol) +} + func (s *BaseSuite) GetBasicLocalRepositoryURL() string { fixture := fixtures.Basic().One() return s.GetLocalRepositoryURL(fixture) |