File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package storage
2+
3+ import (
4+ "errors"
5+ "testing"
6+
7+ "github.com/arschles/assert"
8+ s3 "github.com/minio/minio-go"
9+ )
10+
11+ const (
12+ bucketName = "mybucket"
13+ )
14+
15+ type bucketCreate struct {
16+ name string
17+ acl s3.BucketACL
18+ loc string
19+ }
20+
21+ func TestCreateBucketSuccess (t * testing.T ) {
22+ var res bucketCreate
23+ creator := FakeBucketCreator (func (name string , acl s3.BucketACL , location string ) error {
24+ res = bucketCreate {name : name , acl : acl , loc : location }
25+ return nil
26+ })
27+
28+ assert .NoErr (t , CreateBucket (creator , bucketName ))
29+ assert .Equal (t , res .name , bucketName , "bucket name" )
30+ assert .Equal (t , res .acl , ACLPublicRead , "bucket ACL" )
31+ assert .Equal (t , res .loc , "" , "bucket location" )
32+ }
33+
34+ func TestCreateBucketFailure (t * testing.T ) {
35+ err := errors .New ("test err" )
36+ creator := FakeBucketCreator (func (string , s3.BucketACL , string ) error {
37+ return err
38+ })
39+ assert .Err (t , CreateBucket (creator , bucketName ), err )
40+ }
You can’t perform that action at this time.
0 commit comments