test: new overwrite
param in CreateUploadSession
This commit is contained in:
parent
91377f4676
commit
b8bc5bed13
2 changed files with 5 additions and 5 deletions
|
@ -391,7 +391,7 @@ func TestHandler_Token(t *testing.T) {
|
||||||
{
|
{
|
||||||
clientMock := &remoteclientmock.RemoteClientMock{}
|
clientMock := &remoteclientmock.RemoteClientMock{}
|
||||||
handler.uploadClient = clientMock
|
handler.uploadClient = clientMock
|
||||||
clientMock.On("CreateUploadSession", testMock.Anything, testMock.Anything, int64(10)).Return(errors.New("error"))
|
clientMock.On("CreateUploadSession", testMock.Anything, testMock.Anything, int64(10), false).Return(errors.New("error"))
|
||||||
res, err := handler.Token(context.Background(), 10, &serializer.UploadSession{}, &fsctx.FileStream{})
|
res, err := handler.Token(context.Background(), 10, &serializer.UploadSession{}, &fsctx.FileStream{})
|
||||||
a.Error(err)
|
a.Error(err)
|
||||||
a.Contains(err.Error(), "error")
|
a.Contains(err.Error(), "error")
|
||||||
|
@ -403,7 +403,7 @@ func TestHandler_Token(t *testing.T) {
|
||||||
{
|
{
|
||||||
clientMock := &remoteclientmock.RemoteClientMock{}
|
clientMock := &remoteclientmock.RemoteClientMock{}
|
||||||
handler.uploadClient = clientMock
|
handler.uploadClient = clientMock
|
||||||
clientMock.On("CreateUploadSession", testMock.Anything, testMock.Anything, int64(10)).Return(nil)
|
clientMock.On("CreateUploadSession", testMock.Anything, testMock.Anything, int64(10), false).Return(nil)
|
||||||
clientMock.On("GetUploadURL", int64(10), "").Return("", "", errors.New("error"))
|
clientMock.On("GetUploadURL", int64(10), "").Return("", "", errors.New("error"))
|
||||||
res, err := handler.Token(context.Background(), 10, &serializer.UploadSession{}, &fsctx.FileStream{})
|
res, err := handler.Token(context.Background(), 10, &serializer.UploadSession{}, &fsctx.FileStream{})
|
||||||
a.Error(err)
|
a.Error(err)
|
||||||
|
@ -416,7 +416,7 @@ func TestHandler_Token(t *testing.T) {
|
||||||
{
|
{
|
||||||
clientMock := &remoteclientmock.RemoteClientMock{}
|
clientMock := &remoteclientmock.RemoteClientMock{}
|
||||||
handler.uploadClient = clientMock
|
handler.uploadClient = clientMock
|
||||||
clientMock.On("CreateUploadSession", testMock.Anything, testMock.Anything, int64(10)).Return(nil)
|
clientMock.On("CreateUploadSession", testMock.Anything, testMock.Anything, int64(10), false).Return(nil)
|
||||||
clientMock.On("GetUploadURL", int64(10), "").Return("1", "2", nil)
|
clientMock.On("GetUploadURL", int64(10), "").Return("1", "2", nil)
|
||||||
res, err := handler.Token(context.Background(), 10, &serializer.UploadSession{}, &fsctx.FileStream{})
|
res, err := handler.Token(context.Background(), 10, &serializer.UploadSession{}, &fsctx.FileStream{})
|
||||||
a.NoError(err)
|
a.NoError(err)
|
||||||
|
|
|
@ -11,8 +11,8 @@ type RemoteClientMock struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RemoteClientMock) CreateUploadSession(ctx context.Context, session *serializer.UploadSession, ttl int64) error {
|
func (r *RemoteClientMock) CreateUploadSession(ctx context.Context, session *serializer.UploadSession, ttl int64, overwrite bool) error {
|
||||||
return r.Called(ctx, session, ttl).Error(0)
|
return r.Called(ctx, session, ttl, overwrite).Error(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RemoteClientMock) GetUploadURL(ttl int64, sessionID string) (string, string, error) {
|
func (r *RemoteClientMock) GetUploadURL(ttl int64, sessionID string) (string, string, error) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue