diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-23 00:34:40 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-23 00:34:40 +0200 |
commit | b359f11ea09e642695edcd114b463da4395b10c1 (patch) | |
tree | 6f84c4693429a3815b7523e957801cdb420abb40 /clients/common/common_test.go | |
parent | 6f43e8933ba3c04072d5d104acc6118aac3e52ee (diff) | |
download | go-git-b359f11ea09e642695edcd114b463da4395b10c1.tar.gz |
clients: supporting diferent protocols
Diffstat (limited to 'clients/common/common_test.go')
-rw-r--r-- | clients/common/common_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/clients/common/common_test.go b/clients/common/common_test.go new file mode 100644 index 0000000..0b9b60a --- /dev/null +++ b/clients/common/common_test.go @@ -0,0 +1,37 @@ +package common + +import ( + "testing" + + . "gopkg.in/check.v1" +) + +func Test(t *testing.T) { TestingT(t) } + +type SuiteCommon struct{} + +var _ = Suite(&SuiteCommon{}) + +func (s *SuiteCommon) TestNewEndpoint(c *C) { + e, err := NewEndpoint("git@github.com:user/repository.git") + c.Assert(err, IsNil) + c.Assert(e, Equals, Endpoint("https://github.com/user/repository.git")) +} + +func (s *SuiteCommon) TestNewEndpointWrongForgat(c *C) { + e, err := NewEndpoint("foo") + c.Assert(err, Not(IsNil)) + c.Assert(e, Equals, Endpoint("")) +} + +func (s *SuiteCommon) TestEndpointService(c *C) { + e, _ := NewEndpoint("git@github.com:user/repository.git") + c.Assert(e.Service("foo"), Equals, "https://github.com/user/repository.git/info/refs?service=foo") +} + +const CapabilitiesFixture = "6ecf0ef2c2dffb796033e5a02219af86ec6584e5 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master agent=git/2:2.4.8~dbussink-fix-enterprise-tokens-compilation-1167-gc7006cf" + +func (s *SuiteCommon) TestCapabilitiesSymbolicReference(c *C) { + cap := parseCapabilities(CapabilitiesFixture) + c.Assert(cap.SymbolicReference("HEAD"), Equals, "refs/heads/master") +} |