-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbucket_test.go
More file actions
40 lines (33 loc) · 894 Bytes
/
bucket_test.go
File metadata and controls
40 lines (33 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package storage
import (
"errors"
"testing"
"github.com/arschles/assert"
s3 "github.com/minio/minio-go"
)
const (
bucketName = "mybucket"
)
type bucketCreate struct {
name string
acl s3.BucketACL
loc string
}
func TestCreateBucketSuccess(t *testing.T) {
var res bucketCreate
creator := FakeBucketCreator(func(name string, acl s3.BucketACL, location string) error {
res = bucketCreate{name: name, acl: acl, loc: location}
return nil
})
assert.NoErr(t, CreateBucket(creator, bucketName))
assert.Equal(t, res.name, bucketName, "bucket name")
assert.Equal(t, res.acl, ACLPublicRead, "bucket ACL")
assert.Equal(t, res.loc, "", "bucket location")
}
func TestCreateBucketFailure(t *testing.T) {
err := errors.New("test err")
creator := FakeBucketCreator(func(string, s3.BucketACL, string) error {
return err
})
assert.Err(t, CreateBucket(creator, bucketName), err)
}