aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/ulreq_encode_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-11-29 15:11:00 +0100
committerGitHub <noreply@github.com>2016-11-29 15:11:00 +0100
commitef1a0579fbc6aac510313ce073d1dd8fc8a9202b (patch)
tree6d41484c70cef0ec6b7582e2ac15b9daccf0e54e /plumbing/protocol/packp/ulreq_encode_test.go
parent47007c70c5a696472576a522cd0e265a777f97a8 (diff)
downloadgo-git-ef1a0579fbc6aac510313ce073d1dd8fc8a9202b.tar.gz
protocol/packp: capabilities new Capability entity and List struct, test improvements (#144)
* protocol/pakp: capabilities new Capability entity and List struct, test improvements * etc: example cloud-config file * removing sorting from List.String
Diffstat (limited to 'plumbing/protocol/packp/ulreq_encode_test.go')
-rw-r--r--plumbing/protocol/packp/ulreq_encode_test.go41
1 files changed, 21 insertions, 20 deletions
diff --git a/plumbing/protocol/packp/ulreq_encode_test.go b/plumbing/protocol/packp/ulreq_encode_test.go
index 1eb3175..3b3b6c2 100644
--- a/plumbing/protocol/packp/ulreq_encode_test.go
+++ b/plumbing/protocol/packp/ulreq_encode_test.go
@@ -8,6 +8,7 @@ import (
"gopkg.in/src-d/go-git.v4/plumbing/format/pktline"
. "gopkg.in/check.v1"
+ "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/capability"
)
type UlReqEncodeSuite struct{}
@@ -59,14 +60,14 @@ func (s *UlReqEncodeSuite) TestOneWant(c *C) {
func (s *UlReqEncodeSuite) TestOneWantWithCapabilities(c *C) {
ur := NewUploadRequest()
ur.Wants = append(ur.Wants, plumbing.NewHash("1111111111111111111111111111111111111111"))
- ur.Capabilities.Add("sysref", "HEAD:/refs/heads/master")
- ur.Capabilities.Add("multi_ack")
- ur.Capabilities.Add("thin-pack")
- ur.Capabilities.Add("side-band")
- ur.Capabilities.Add("ofs-delta")
+ ur.Capabilities.Add(capability.MultiACK)
+ ur.Capabilities.Add(capability.OFSDelta)
+ ur.Capabilities.Add(capability.Sideband)
+ ur.Capabilities.Add(capability.SymRef, "HEAD:/refs/heads/master")
+ ur.Capabilities.Add(capability.ThinPack)
expected := []string{
- "want 1111111111111111111111111111111111111111 multi_ack ofs-delta side-band sysref=HEAD:/refs/heads/master thin-pack\n",
+ "want 1111111111111111111111111111111111111111 multi_ack ofs-delta side-band symref=HEAD:/refs/heads/master thin-pack\n",
pktline.FlushString,
}
@@ -101,14 +102,14 @@ func (s *UlReqEncodeSuite) TestWantsWithCapabilities(c *C) {
ur.Wants = append(ur.Wants, plumbing.NewHash("2222222222222222222222222222222222222222"))
ur.Wants = append(ur.Wants, plumbing.NewHash("5555555555555555555555555555555555555555"))
- ur.Capabilities.Add("sysref", "HEAD:/refs/heads/master")
- ur.Capabilities.Add("multi_ack")
- ur.Capabilities.Add("thin-pack")
- ur.Capabilities.Add("side-band")
- ur.Capabilities.Add("ofs-delta")
+ ur.Capabilities.Add(capability.MultiACK)
+ ur.Capabilities.Add(capability.OFSDelta)
+ ur.Capabilities.Add(capability.Sideband)
+ ur.Capabilities.Add(capability.SymRef, "HEAD:/refs/heads/master")
+ ur.Capabilities.Add(capability.ThinPack)
expected := []string{
- "want 1111111111111111111111111111111111111111 multi_ack ofs-delta side-band sysref=HEAD:/refs/heads/master thin-pack\n",
+ "want 1111111111111111111111111111111111111111 multi_ack ofs-delta side-band symref=HEAD:/refs/heads/master thin-pack\n",
"want 2222222222222222222222222222222222222222\n",
"want 3333333333333333333333333333333333333333\n",
"want 4444444444444444444444444444444444444444\n",
@@ -122,7 +123,7 @@ func (s *UlReqEncodeSuite) TestWantsWithCapabilities(c *C) {
func (s *UlReqEncodeSuite) TestShallow(c *C) {
ur := NewUploadRequest()
ur.Wants = append(ur.Wants, plumbing.NewHash("1111111111111111111111111111111111111111"))
- ur.Capabilities.Add("multi_ack")
+ ur.Capabilities.Add(capability.MultiACK)
ur.Shallows = append(ur.Shallows, plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))
expected := []string{
@@ -137,7 +138,7 @@ func (s *UlReqEncodeSuite) TestShallow(c *C) {
func (s *UlReqEncodeSuite) TestManyShallows(c *C) {
ur := NewUploadRequest()
ur.Wants = append(ur.Wants, plumbing.NewHash("1111111111111111111111111111111111111111"))
- ur.Capabilities.Add("multi_ack")
+ ur.Capabilities.Add(capability.MultiACK)
ur.Shallows = append(ur.Shallows, plumbing.NewHash("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
ur.Shallows = append(ur.Shallows, plumbing.NewHash("dddddddddddddddddddddddddddddddddddddddd"))
ur.Shallows = append(ur.Shallows, plumbing.NewHash("cccccccccccccccccccccccccccccccccccccccc"))
@@ -225,11 +226,11 @@ func (s *UlReqEncodeSuite) TestAll(c *C) {
ur.Wants = append(ur.Wants, plumbing.NewHash("2222222222222222222222222222222222222222"))
ur.Wants = append(ur.Wants, plumbing.NewHash("5555555555555555555555555555555555555555"))
- ur.Capabilities.Add("sysref", "HEAD:/refs/heads/master")
- ur.Capabilities.Add("multi_ack")
- ur.Capabilities.Add("thin-pack")
- ur.Capabilities.Add("side-band")
- ur.Capabilities.Add("ofs-delta")
+ ur.Capabilities.Add(capability.MultiACK)
+ ur.Capabilities.Add(capability.OFSDelta)
+ ur.Capabilities.Add(capability.Sideband)
+ ur.Capabilities.Add(capability.SymRef, "HEAD:/refs/heads/master")
+ ur.Capabilities.Add(capability.ThinPack)
ur.Shallows = append(ur.Shallows, plumbing.NewHash("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"))
ur.Shallows = append(ur.Shallows, plumbing.NewHash("dddddddddddddddddddddddddddddddddddddddd"))
@@ -240,7 +241,7 @@ func (s *UlReqEncodeSuite) TestAll(c *C) {
ur.Depth = DepthSince(since)
expected := []string{
- "want 1111111111111111111111111111111111111111 multi_ack ofs-delta side-band sysref=HEAD:/refs/heads/master thin-pack\n",
+ "want 1111111111111111111111111111111111111111 multi_ack ofs-delta side-band symref=HEAD:/refs/heads/master thin-pack\n",
"want 2222222222222222222222222222222222222222\n",
"want 3333333333333333333333333333333333333333\n",
"want 4444444444444444444444444444444444444444\n",