add prefix in test file gcs store
This commit is contained in:
parent
e824008fe2
commit
fe62533f1e
|
@ -4,9 +4,10 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/net/context"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"cloud.google.com/go/storage"
|
"cloud.google.com/go/storage"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -19,6 +20,7 @@ import (
|
||||||
|
|
||||||
const mockID = "123456789abcdefghijklmnopqrstuvwxyz"
|
const mockID = "123456789abcdefghijklmnopqrstuvwxyz"
|
||||||
const mockBucket = "bucket"
|
const mockBucket = "bucket"
|
||||||
|
const mockObjPrefix = ""
|
||||||
const mockSize = 1337
|
const mockSize = 1337
|
||||||
const mockReaderData = "helloworld"
|
const mockReaderData = "helloworld"
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ func TestNewUpload(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
assert.Equal(store.Bucket, mockBucket)
|
assert.Equal(store.Bucket, mockBucket)
|
||||||
|
|
||||||
|
@ -93,7 +95,7 @@ func TestGetInfo(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
assert.Equal(store.Bucket, mockBucket)
|
assert.Equal(store.Bucket, mockBucket)
|
||||||
|
|
||||||
|
@ -156,7 +158,7 @@ func TestGetInfoNotFound(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
params := gcsstore.GCSObjectParams{
|
params := gcsstore.GCSObjectParams{
|
||||||
Bucket: store.Bucket,
|
Bucket: store.Bucket,
|
||||||
|
@ -201,7 +203,7 @@ func TestGetReader(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
assert.Equal(store.Bucket, mockBucket)
|
assert.Equal(store.Bucket, mockBucket)
|
||||||
|
|
||||||
|
@ -230,7 +232,7 @@ func TestTerminate(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
assert.Equal(store.Bucket, mockBucket)
|
assert.Equal(store.Bucket, mockBucket)
|
||||||
|
|
||||||
|
@ -252,7 +254,7 @@ func TestFinishUpload(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
assert.Equal(store.Bucket, mockBucket)
|
assert.Equal(store.Bucket, mockBucket)
|
||||||
|
|
||||||
|
@ -371,7 +373,7 @@ func TestWriteChunk(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
service := NewMockGCSAPI(mockCtrl)
|
service := NewMockGCSAPI(mockCtrl)
|
||||||
store := gcsstore.New(mockBucket, service)
|
store := gcsstore.New(mockBucket, mockObjPrefix, service)
|
||||||
|
|
||||||
assert.Equal(store.Bucket, mockBucket)
|
assert.Equal(store.Bucket, mockBucket)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue