|
|
@ -162,7 +162,7 @@ func (s *MySuite) TestEmptyObject(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "key", |
|
|
|
Key: "key", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "d41d8cd98f00b204e9800998ecf8427e", |
|
|
|
Md5: "d41d8cd98f00b204e9800998ecf8427e", |
|
|
|
Size: 0, |
|
|
|
Size: 0, |
|
|
|
} |
|
|
|
} |
|
|
@ -209,7 +209,7 @@ func (s *MySuite) TestBucket(c *C) { |
|
|
|
typedDriver := s.MockDriver |
|
|
|
typedDriver := s.MockDriver |
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
Name: "bucket", |
|
|
|
Name: "bucket", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
} |
|
|
|
} |
|
|
|
typedDriver.On("CreateBucket", "bucket", "private").Return(nil).Once() |
|
|
|
typedDriver.On("CreateBucket", "bucket", "private").Return(nil).Once() |
|
|
@ -244,7 +244,7 @@ func (s *MySuite) TestObject(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "key", |
|
|
|
Key: "key", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", |
|
|
|
Size: 11, |
|
|
|
Size: 11, |
|
|
|
} |
|
|
|
} |
|
|
@ -294,7 +294,7 @@ func (s *MySuite) TestMultipleObjects(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "object1", |
|
|
|
Key: "object1", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Size: 9, |
|
|
|
Size: 9, |
|
|
|
} |
|
|
|
} |
|
|
@ -302,7 +302,7 @@ func (s *MySuite) TestMultipleObjects(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "object2", |
|
|
|
Key: "object2", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Size: 9, |
|
|
|
Size: 9, |
|
|
|
} |
|
|
|
} |
|
|
@ -310,7 +310,7 @@ func (s *MySuite) TestMultipleObjects(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "object3", |
|
|
|
Key: "object3", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Size: 11, |
|
|
|
Size: 11, |
|
|
|
} |
|
|
|
} |
|
|
@ -479,7 +479,7 @@ func (s *MySuite) TestHeader(c *C) { |
|
|
|
|
|
|
|
|
|
|
|
bucketMetadata := drivers.BucketMetadata{ |
|
|
|
bucketMetadata := drivers.BucketMetadata{ |
|
|
|
Name: "bucket", |
|
|
|
Name: "bucket", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
} |
|
|
|
} |
|
|
|
typedDriver.On("GetBucketMetadata", "bucket").Return(bucketMetadata, nil).Once() |
|
|
|
typedDriver.On("GetBucketMetadata", "bucket").Return(bucketMetadata, nil).Once() |
|
|
@ -498,7 +498,7 @@ func (s *MySuite) TestHeader(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "object", |
|
|
|
Key: "object", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", // TODO correct md5
|
|
|
|
Size: 11, |
|
|
|
Size: 11, |
|
|
|
} |
|
|
|
} |
|
|
@ -593,8 +593,8 @@ func (s *MySuite) TestPutObject(c *C) { |
|
|
|
c.Assert(err, Not(IsNil)) |
|
|
|
c.Assert(err, Not(IsNil)) |
|
|
|
|
|
|
|
|
|
|
|
// breaks on fs driver,// breaks on fs driver, so we subtract one second
|
|
|
|
// breaks on fs driver,// breaks on fs driver, so we subtract one second
|
|
|
|
// date1 := time.Now()
|
|
|
|
// date1 := time.Now().UTC()
|
|
|
|
date1 := time.Now().Add(-time.Second) |
|
|
|
date1 := time.Now().UTC().Add(-time.Second) |
|
|
|
|
|
|
|
|
|
|
|
// Put Bucket before - Put Object into a bucket
|
|
|
|
// Put Bucket before - Put Object into a bucket
|
|
|
|
typedDriver.On("CreateBucket", "bucket", "private").Return(nil).Once() |
|
|
|
typedDriver.On("CreateBucket", "bucket", "private").Return(nil).Once() |
|
|
@ -612,7 +612,7 @@ func (s *MySuite) TestPutObject(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "two", |
|
|
|
Key: "two", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", |
|
|
|
Md5: "5eb63bbbe01eeed093cb22bb8f5acdc3", |
|
|
|
Size: 11, |
|
|
|
Size: 11, |
|
|
|
} |
|
|
|
} |
|
|
@ -626,7 +626,7 @@ func (s *MySuite) TestPutObject(c *C) { |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(response.StatusCode, Equals, http.StatusOK) |
|
|
|
c.Assert(response.StatusCode, Equals, http.StatusOK) |
|
|
|
|
|
|
|
|
|
|
|
date2 := time.Now() |
|
|
|
date2 := time.Now().UTC() |
|
|
|
|
|
|
|
|
|
|
|
resources.Maxkeys = 1000 |
|
|
|
resources.Maxkeys = 1000 |
|
|
|
resources.Prefix = "" |
|
|
|
resources.Prefix = "" |
|
|
@ -687,7 +687,7 @@ func (s *MySuite) TestListBuckets(c *C) { |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
|
|
|
|
|
|
|
|
bucketMetadata := []drivers.BucketMetadata{ |
|
|
|
bucketMetadata := []drivers.BucketMetadata{ |
|
|
|
{Name: "foo", Created: time.Now()}, |
|
|
|
{Name: "foo", Created: time.Now().UTC()}, |
|
|
|
} |
|
|
|
} |
|
|
|
typedDriver.On("ListBuckets").Return(bucketMetadata, nil).Once() |
|
|
|
typedDriver.On("ListBuckets").Return(bucketMetadata, nil).Once() |
|
|
|
request, err = http.NewRequest("GET", testServer.URL+"/", nil) |
|
|
|
request, err = http.NewRequest("GET", testServer.URL+"/", nil) |
|
|
@ -709,7 +709,7 @@ func (s *MySuite) TestListBuckets(c *C) { |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
|
|
|
|
|
|
|
|
bucketMetadata = []drivers.BucketMetadata{ |
|
|
|
bucketMetadata = []drivers.BucketMetadata{ |
|
|
|
{Name: "bar", Created: time.Now()}, |
|
|
|
{Name: "bar", Created: time.Now().UTC()}, |
|
|
|
bucketMetadata[0], |
|
|
|
bucketMetadata[0], |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -810,7 +810,7 @@ func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) { |
|
|
|
err := driver.CreateBucket("foo", "private") |
|
|
|
err := driver.CreateBucket("foo", "private") |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
|
|
|
|
|
|
|
|
typedDriver.On("ListBuckets").Return([]drivers.BucketMetadata{{Name: "foo", Created: time.Now()}}, nil) |
|
|
|
typedDriver.On("ListBuckets").Return([]drivers.BucketMetadata{{Name: "foo", Created: time.Now().UTC()}}, nil) |
|
|
|
request, err := http.NewRequest("GET", testServer.URL+"/", nil) |
|
|
|
request, err := http.NewRequest("GET", testServer.URL+"/", nil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
c.Assert(err, IsNil) |
|
|
|
request.Header.Add("Accept", "application/json") |
|
|
|
request.Header.Add("Accept", "application/json") |
|
|
@ -849,7 +849,7 @@ func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) { |
|
|
|
|
|
|
|
|
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
Name: "foo", |
|
|
|
Name: "foo", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -890,7 +890,7 @@ func (s *MySuite) TestContentTypePersists(c *C) { |
|
|
|
|
|
|
|
|
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
Name: "bucket", |
|
|
|
Name: "bucket", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
} |
|
|
|
} |
|
|
|
// test head
|
|
|
|
// test head
|
|
|
@ -898,7 +898,7 @@ func (s *MySuite) TestContentTypePersists(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "one", |
|
|
|
Key: "one", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "d41d8cd98f00b204e9800998ecf8427e", |
|
|
|
Md5: "d41d8cd98f00b204e9800998ecf8427e", |
|
|
|
Size: 0, |
|
|
|
Size: 0, |
|
|
|
} |
|
|
|
} |
|
|
@ -944,7 +944,7 @@ func (s *MySuite) TestContentTypePersists(c *C) { |
|
|
|
Bucket: "bucket", |
|
|
|
Bucket: "bucket", |
|
|
|
Key: "one", |
|
|
|
Key: "one", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
// Fix MD5
|
|
|
|
// Fix MD5
|
|
|
|
Md5: "d41d8cd98f00b204e9800998ecf8427e", |
|
|
|
Md5: "d41d8cd98f00b204e9800998ecf8427e", |
|
|
|
Size: 0, |
|
|
|
Size: 0, |
|
|
@ -1003,7 +1003,7 @@ func (s *MySuite) TestPartialContent(c *C) { |
|
|
|
Bucket: "foo", |
|
|
|
Bucket: "foo", |
|
|
|
Key: "bar", |
|
|
|
Key: "bar", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "e81c4e4f2b7b93b481e13a8553c2ae1b", // TODO Determine if md5 of range or full object needed
|
|
|
|
Md5: "e81c4e4f2b7b93b481e13a8553c2ae1b", // TODO Determine if md5 of range or full object needed
|
|
|
|
Size: 11, |
|
|
|
Size: 11, |
|
|
|
} |
|
|
|
} |
|
|
@ -1127,7 +1127,7 @@ func (s *MySuite) TestListBucketsErrors(c *C) { |
|
|
|
|
|
|
|
|
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
Name: "foo", |
|
|
|
Name: "foo", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1224,7 +1224,7 @@ func (s *MySuite) TestGetObjectErrors(c *C) { |
|
|
|
|
|
|
|
|
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
metadata := drivers.BucketMetadata{ |
|
|
|
Name: "foo", |
|
|
|
Name: "foo", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
ACL: drivers.BucketACL("private"), |
|
|
|
} |
|
|
|
} |
|
|
|
typedDriver.On("GetBucketMetadata", "foo").Return(metadata, nil).Once() |
|
|
|
typedDriver.On("GetBucketMetadata", "foo").Return(metadata, nil).Once() |
|
|
@ -1300,7 +1300,7 @@ func (s *MySuite) TestGetObjectRangeErrors(c *C) { |
|
|
|
Key: "bar", |
|
|
|
Key: "bar", |
|
|
|
|
|
|
|
|
|
|
|
ContentType: "application/octet-stream", |
|
|
|
ContentType: "application/octet-stream", |
|
|
|
Created: time.Now(), |
|
|
|
Created: time.Now().UTC(), |
|
|
|
Md5: "e81c4e4f2b7b93b481e13a8553c2ae1b", |
|
|
|
Md5: "e81c4e4f2b7b93b481e13a8553c2ae1b", |
|
|
|
Size: 11, |
|
|
|
Size: 11, |
|
|
|
} |
|
|
|
} |
|
|
|