github.com/hoffie/larasync@v0.0.0-20151025221940-0384d2bddcef/repository/content/byteStorage_test.go (about)

     1  package content
     2  
     3  import (
     4  	. "gopkg.in/check.v1"
     5  )
     6  
     7  type ByteStorageTests struct {
     8  	dir string
     9  }
    10  
    11  var _ = Suite(&ByteStorageTests{})
    12  
    13  func (t *ByteStorageTests) SetUpTest(c *C) {
    14  	t.dir = c.MkDir()
    15  }
    16  
    17  func (t *ByteStorageTests) Test(c *C) {
    18  	s := NewFileStorage(t.dir)
    19  	b := NewByteStorage(s)
    20  	myContent := []byte("asd")
    21  	err := b.SetBytes("foo", myContent)
    22  	c.Assert(err, IsNil)
    23  	gotContent, err := b.GetBytes("foo")
    24  	c.Assert(err, IsNil)
    25  	c.Assert(gotContent, DeepEquals, myContent)
    26  }