aboutsummaryrefslogtreecommitdiffstats
path: root/storage/test/storage_suite.go
diff options
context:
space:
mode:
Diffstat (limited to 'storage/test/storage_suite.go')
-rw-r--r--storage/test/storage_suite.go32
1 files changed, 30 insertions, 2 deletions
diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go
index d6c8afa..2a10c78 100644
--- a/storage/test/storage_suite.go
+++ b/storage/test/storage_suite.go
@@ -22,7 +22,6 @@ type Storer interface {
storer.ShallowStorer
storer.IndexStorer
config.ConfigStorer
-
storage.ModuleStorer
}
@@ -245,6 +244,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)
@@ -297,7 +323,9 @@ func (s *BaseStorageSuite) TestSetConfigAndConfig(c *C) {
cfg, err := s.Storer.Config()
c.Assert(err, IsNil)
- c.Assert(cfg, DeepEquals, expected)
+
+ c.Assert(cfg.Core.IsBare, DeepEquals, expected.Core.IsBare)
+ c.Assert(cfg.Remotes, DeepEquals, expected.Remotes)
}
func (s *BaseStorageSuite) TestIndex(c *C) {