aboutsummaryrefslogtreecommitdiffstats
path: root/clients/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'clients/common_test.go')
-rw-r--r--clients/common_test.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/clients/common_test.go b/clients/common_test.go
new file mode 100644
index 0000000..f8bcbd3
--- /dev/null
+++ b/clients/common_test.go
@@ -0,0 +1,38 @@
+package clients
+
+import (
+ "fmt"
+ "testing"
+
+ . "gopkg.in/check.v1"
+)
+
+func Test(t *testing.T) { TestingT(t) }
+
+type SuiteCommon struct{}
+
+var _ = Suite(&SuiteCommon{})
+
+func (s *SuiteCommon) TestNewGitUploadPackService(c *C) {
+ var tests = [...]struct {
+ input string
+ err bool
+ expected string
+ }{
+ {"ht/ml://example.com", true, "<nil>"},
+ {"", true, "<nil>"},
+ {"-", true, "<nil>"},
+ {"!@", true, "<nil>"},
+ {"badscheme://github.com/src-d/go-git", true, "<nil>"},
+ {"http://github.com/src-d/go-git", false, "*http.GitUploadPackService"},
+ {"https://github.com/src-d/go-git", false, "*http.GitUploadPackService"},
+ {"ssh://github.com/src-d/go-git", false, "*ssh.GitUploadPackService"},
+ {"file://github.com/src-d/go-git", false, "*file.GitUploadPackService"},
+ }
+
+ for i, t := range tests {
+ output, err := NewGitUploadPackService(t.input)
+ c.Assert(err != nil, Equals, t.err, Commentf("%d) %q: wrong error value", i, t.input))
+ c.Assert(fmt.Sprintf("%T", output), Equals, t.expected, Commentf("%d) %q: wrong type", i, t.input))
+ }
+}