aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/updreq_test.go
blob: 72b5e3c0a467bd1077b7dd0af8594236bce2b8c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package packp

import (
	"srcd.works/go-git.v4/plumbing/protocol/packp/capability"

	. "gopkg.in/check.v1"
)

type UpdReqSuite struct{}

var _ = Suite(&UpdReqSuite{})

func (s *UpdReqSuite) TestNewReferenceUpdateRequestFromCapabilities(c *C) {
	cap := capability.NewList()
	cap.Set(capability.Sideband)
	cap.Set(capability.Sideband64k)
	cap.Set(capability.Quiet)
	cap.Set(capability.ReportStatus)
	cap.Set(capability.DeleteRefs)
	cap.Set(capability.PushCert, "foo")
	cap.Set(capability.Atomic)
	cap.Set(capability.Agent, "foo")

	r := NewReferenceUpdateRequestFromCapabilities(cap)
	c.Assert(r.Capabilities.String(), Equals,
		"agent=go-git/4.x report-status",
	)

	cap = capability.NewList()
	cap.Set(capability.Agent, "foo")

	r = NewReferenceUpdateRequestFromCapabilities(cap)
	c.Assert(r.Capabilities.String(), Equals, "agent=go-git/4.x")

	cap = capability.NewList()

	r = NewReferenceUpdateRequestFromCapabilities(cap)
	c.Assert(r.Capabilities.String(), Equals, "")
}