func (s *WrapperSuite) SetUpTest(c *gc.C) { s.IsolationSuite.SetUpTest(c) var err error s.rawstor, err = filestorage.NewRawFileStorage(c.MkDir()) c.Assert(err, gc.IsNil) s.metastor = filestorage.NewMetadataStorage() s.original = filestorage.NewMetadata(nil) s.original.SetFile(10, "", "") }
func (s *RawFileSuite) TestRawFileStorageRemoveFile(c *gc.C) { stor, err := filestorage.NewRawFileStorage(c.MkDir()) c.Assert(err, gc.IsNil) data := bytes.NewBufferString("spam") err = stor.AddFile("eggs", data, 4) c.Assert(err, gc.IsNil) err = stor.RemoveFile("eggs") c.Check(err, gc.IsNil) _, err = stor.File("eggs") c.Check(err, gc.NotNil) }
func (s *RawFileSuite) TestRawFileStorageFile(c *gc.C) { stor, err := filestorage.NewRawFileStorage(c.MkDir()) c.Assert(err, gc.IsNil) data := bytes.NewBufferString("spam") err = stor.AddFile("eggs", data, 4) c.Assert(err, gc.IsNil) file, err := stor.File("eggs") c.Assert(err, gc.IsNil) content, err := ioutil.ReadAll(file) c.Assert(err, gc.IsNil) c.Check(string(content), gc.Equals, "spam") }
func (s *RawFileSuite) TestRawFileStorageNewRawFileStorage(c *gc.C) { stor, err := filestorage.NewRawFileStorage(c.MkDir()) c.Assert(err, gc.IsNil) c.Check(stor, gc.NotNil) }