diff options
author | Antoine GIRARD <sapk@sapk.fr> | 2019-04-22 00:59:47 +0200 |
---|---|---|
committer | Antoine GIRARD <sapk@sapk.fr> | 2019-04-24 23:07:01 +0200 |
commit | a04488c786baffa1faea9f501349fa63c28931a1 (patch) | |
tree | 5ecc242d91281bbccb80434507ada6a5ba8e74e6 /plumbing/object/tag_test.go | |
parent | 5c6d199dc675465f5e103ea36c0bfcb9d3ebc565 (diff) | |
download | go-git-a04488c786baffa1faea9f501349fa63c28931a1.tar.gz |
plumbing: object/{commit,tag} add EncodeWithoutSignature, Implement #1116
Signed-off-by: Antoine GIRARD <sapk@sapk.fr>
Diffstat (limited to 'plumbing/object/tag_test.go')
-rw-r--r-- | plumbing/object/tag_test.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/plumbing/object/tag_test.go b/plumbing/object/tag_test.go index 0ef7136..addec8d 100644 --- a/plumbing/object/tag_test.go +++ b/plumbing/object/tag_test.go @@ -3,16 +3,17 @@ package object import ( "fmt" "io" + "io/ioutil" "strings" "time" + fixtures "gopkg.in/src-d/go-git-fixtures.v3" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/cache" "gopkg.in/src-d/go-git.v4/storage/filesystem" "gopkg.in/src-d/go-git.v4/storage/memory" . "gopkg.in/check.v1" - "gopkg.in/src-d/go-git-fixtures.v3" ) type TagSuite struct { @@ -447,3 +448,24 @@ HdzbB2ak/HxIeCqmHVlmUqa+WfTMUJcsgOm3/ZFPCSoL6l0bz9Z1XVbiyD03 _, err = tag.Verify(armoredKeyRing) c.Assert(err, IsNil) } + +func (s *TagSuite) TestEncodeWithoutSignature(c *C) { + //Similar to TestString since no signature + encoded := &plumbing.MemoryObject{} + tag := s.tag(c, plumbing.NewHash("b742a2a9fa0afcfa9a6fad080980fbc26b007c69")) + err := tag.EncodeWithoutSignature(encoded) + c.Assert(err, IsNil) + er, err := encoded.Reader() + c.Assert(err, IsNil) + payload, err := ioutil.ReadAll(er) + c.Assert(err, IsNil) + + c.Assert(string(payload), Equals, ""+ + "object f7b877701fbf855b44c0a9e86f3fdce2c298b07f\n"+ + "type commit\n"+ + "tag annotated-tag\n"+ + "tagger Máximo Cuadros <mcuadros@gmail.com> 1474485215 +0200\n"+ + "\n"+ + "example annotated tag\n", + ) +} |