aboutsummaryrefslogtreecommitdiffstats
path: root/clients/common_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-02-11 12:09:02 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-02-11 12:09:02 +0100
commitd0155564148550167e756e440b5f9ce71c76abb3 (patch)
treecb6f7637286c8236997dc736133bbac4217d5e35 /clients/common_test.go
parent35ee4d749be21691b78a7465361ad47179fe2eff (diff)
downloadgo-git-d0155564148550167e756e440b5f9ce71c76abb3.tar.gz
clients: removing url from the clients constructor
Diffstat (limited to 'clients/common_test.go')
-rw-r--r--clients/common_test.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/clients/common_test.go b/clients/common_test.go
index ff9ca32..c3b766b 100644
--- a/clients/common_test.go
+++ b/clients/common_test.go
@@ -37,7 +37,7 @@ func (s *SuiteCommon) TestNewGitUploadPackService(c *C) {
type dummyProtocolService struct{}
-func newDummyProtocolService(url string) common.GitUploadPackService {
+func newDummyProtocolService() common.GitUploadPackService {
return &dummyProtocolService{}
}
@@ -59,23 +59,24 @@ func (s *dummyProtocolService) Fetch(r *common.GitUploadPackRequest) (io.ReadClo
func (s *SuiteCommon) TestInstallProtocol(c *C) {
var tests = [...]struct {
- scheme string
- serviceFn ServiceFromURLFunc
- panic bool
+ scheme string
+ service common.GitUploadPackService
+ panic bool
}{
{"panic", nil, true},
- {"newscheme", newDummyProtocolService, false},
- {"http", newDummyProtocolService, false},
+ {"newscheme", newDummyProtocolService(), false},
+ {"http", newDummyProtocolService(), false},
}
for i, t := range tests {
if t.panic {
- fmt.Println(t.serviceFn == nil)
- c.Assert(func() { InstallProtocol(t.scheme, t.serviceFn) }, PanicMatches, `nil service`)
+ fmt.Println(t.service == nil)
+ c.Assert(func() { InstallProtocol(t.scheme, t.service) }, PanicMatches, `nil service`)
continue
}
- InstallProtocol(t.scheme, t.serviceFn)
- c.Assert(typeAsString(KnownProtocols[t.scheme]), Equals, typeAsString(t.serviceFn), Commentf("%d) wrong service", i))
+
+ InstallProtocol(t.scheme, t.service)
+ c.Assert(typeAsString(KnownProtocols[t.scheme]), Equals, typeAsString(t.service), Commentf("%d) wrong service", i))
// reset to default protocols after installing
if v, ok := DefaultProtocols[t.scheme]; ok {
InstallProtocol(t.scheme, v)