|
|
|
@ -14,7 +14,7 @@ |
|
|
|
|
* limitations under the License. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
package minioapi_test |
|
|
|
|
package api_test |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"bytes" |
|
|
|
@ -28,7 +28,7 @@ import ( |
|
|
|
|
"testing" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/minio-io/minio/pkg/api/minioapi" |
|
|
|
|
"github.com/minio-io/minio/pkg/api" |
|
|
|
|
mstorage "github.com/minio-io/minio/pkg/storage" |
|
|
|
|
"github.com/minio-io/minio/pkg/storage/memory" |
|
|
|
|
|
|
|
|
@ -43,7 +43,7 @@ var _ = Suite(&MySuite{}) |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestNonExistantObject(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -55,7 +55,7 @@ func (s *MySuite) TestNonExistantObject(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestEmptyObject(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -80,7 +80,7 @@ func (s *MySuite) TestEmptyObject(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestObject(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -103,7 +103,7 @@ func (s *MySuite) TestObject(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestMultipleObjects(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -183,7 +183,7 @@ func (s *MySuite) TestMultipleObjects(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestNotImplemented(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -194,7 +194,7 @@ func (s *MySuite) TestNotImplemented(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestHeader(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -217,7 +217,7 @@ func (s *MySuite) TestHeader(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestPutBucket(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -242,7 +242,7 @@ func (s *MySuite) TestPutBucket(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestPutObject(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -299,7 +299,7 @@ func (s *MySuite) TestPutObject(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestListBuckets(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -339,8 +339,8 @@ func (s *MySuite) TestListBuckets(c *C) { |
|
|
|
|
c.Assert(listResponse.Buckets.Bucket[1].Name, Equals, "foo") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func readListBucket(reader io.Reader) (minioapi.BucketListResponse, error) { |
|
|
|
|
var results minioapi.BucketListResponse |
|
|
|
|
func readListBucket(reader io.Reader) (api.BucketListResponse, error) { |
|
|
|
|
var results api.BucketListResponse |
|
|
|
|
decoder := xml.NewDecoder(reader) |
|
|
|
|
err := decoder.Decode(&results) |
|
|
|
|
return results, err |
|
|
|
@ -378,7 +378,7 @@ func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentTy |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -403,7 +403,7 @@ func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|
|
|
|
@ -428,7 +428,7 @@ func (s *MySuite) TestXMLNameNotInObjectListJson(c *C) { |
|
|
|
|
|
|
|
|
|
func (s *MySuite) TestContentTypePersists(c *C) { |
|
|
|
|
_, _, storage := memory.Start() |
|
|
|
|
httpHandler := minioapi.HTTPHandler("", storage) |
|
|
|
|
httpHandler := api.HTTPHandler("", storage) |
|
|
|
|
testServer := httptest.NewServer(httpHandler) |
|
|
|
|
defer testServer.Close() |
|
|
|
|
|