test(wopi): add tests for wopi client

This commit is contained in:
HFO4
2023-01-10 19:56:02 +08:00
parent f7fdf10d70
commit 99434d7aa5
7 changed files with 462 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
package wopimock
import (
model "github.com/cloudreve/Cloudreve/v3/models"
"github.com/cloudreve/Cloudreve/v3/pkg/wopi"
"github.com/stretchr/testify/mock"
)
type WopiClientMock struct {
mock.Mock
}
func (w *WopiClientMock) NewSession(user *model.User, file *model.File, action wopi.ActonType) (*wopi.Session, error) {
args := w.Called(user, file, action)
return args.Get(0).(*wopi.Session), args.Error(1)
}
func (w *WopiClientMock) AvailableExts() []string {
args := w.Called()
return args.Get(0).([]string)
}