aboutsummaryrefslogtreecommitdiffstats
path: root/storage/test
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-02-20 23:13:33 +0100
committerGitHub <noreply@github.com>2017-02-20 23:13:33 +0100
commitefe9ecf9a2b4d9346a1ae105210b4dabb26aa2a8 (patch)
tree7e4315a2a18a46cf691c19d5ae2e96eb84e96c18 /storage/test
parentf5a9c7ed5ab58afa255c2f405b30f06f88a6aecf (diff)
parent53385d62c573e0e2ef67587099cce0144cf60b3c (diff)
downloadgo-git-efe9ecf9a2b4d9346a1ae105210b4dabb26aa2a8.tar.gz
Merge pull request #269 from smola/remove-reference
plumbing/storer: add RemoveReference
Diffstat (limited to 'storage/test')
-rw-r--r--storage/test/storage_suite.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go
index 6fc2937..e09a673 100644
--- a/storage/test/storage_suite.go
+++ b/storage/test/storage_suite.go
@@ -242,6 +242,33 @@ func (s *BaseStorageSuite) TestSetReferenceAndGetReference(c *C) {
c.Assert(e.Hash().String(), Equals, "bc9968d75e48de59f0870ffb71f5e160bbbdcf52")
}
+func (s *BaseStorageSuite) TestRemoveReference(c *C) {
+ err := s.Storer.SetReference(
+ plumbing.NewReferenceFromStrings("foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"),
+ )
+ c.Assert(err, IsNil)
+
+ err = s.Storer.RemoveReference(plumbing.ReferenceName("foo"))
+ c.Assert(err, IsNil)
+
+ _, err = s.Storer.Reference(plumbing.ReferenceName("foo"))
+ c.Assert(err, Equals, plumbing.ErrReferenceNotFound)
+}
+
+func (s *BaseStorageSuite) TestRemoveReferenceNonExistent(c *C) {
+ err := s.Storer.SetReference(
+ plumbing.NewReferenceFromStrings("foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"),
+ )
+ c.Assert(err, IsNil)
+
+ err = s.Storer.RemoveReference(plumbing.ReferenceName("nonexistent"))
+ c.Assert(err, IsNil)
+
+ e, err := s.Storer.Reference(plumbing.ReferenceName("foo"))
+ c.Assert(err, IsNil)
+ c.Assert(e.Hash().String(), Equals, "bc9968d75e48de59f0870ffb71f5e160bbbdcf52")
+}
+
func (s *BaseStorageSuite) TestGetReferenceNotFound(c *C) {
r, err := s.Storer.Reference(plumbing.ReferenceName("bar"))
c.Assert(err, Equals, plumbing.ErrReferenceNotFound)