You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
minio/pkg/donutbox/donutmem/donutmem_test.go

45 lines
879 B

package donutmem
import (
"testing"
"bytes"
. "gopkg.in/check.v1"
"io"
)
func Test(t *testing.T) { TestingT(t) }
type MySuite struct{}
var _ = Suite(&MySuite{})
func (s *MySuite) TestAPISuite(c *C) {
c.Skip("Not implemented")
donut := NewDonutMem()
writer, ch, err := donut.GetObjectWriter("foo", "bar", 0, 2)
c.Assert(writer, IsNil)
c.Assert(ch, IsNil)
c.Assert(err, Not(IsNil))
err = donut.CreateBucket("foo")
c.Assert(err, IsNil)
writer, ch, err = donut.GetObjectWriter("foo", "bar", 0, 2)
c.Assert(err, IsNil)
c.Assert(ch, Not(IsNil))
writer.Write([]byte("Hello World"))
writer.Close()
res := <-ch
c.Assert(res.Err, IsNil)
reader, err := donut.GetObjectReader("foo", "bar", 0)
c.Assert(err, IsNil)
var target bytes.Buffer
_, err = io.Copy(&target, reader)
c.Assert(err, IsNil)
c.Assert(target.Bytes(), DeepEquals, []byte("Hello World"))
}