Test: new changes in pkg: cache, cluster, conf

This commit is contained in:
HFO4
2022-03-26 15:32:57 +08:00
parent 1821923b74
commit 636ac52a3f
8 changed files with 144 additions and 137 deletions

View File

@@ -7,11 +7,9 @@ import (
"github.com/cloudreve/Cloudreve/v3/pkg/auth"
"github.com/cloudreve/Cloudreve/v3/pkg/balancer"
"github.com/cloudreve/Cloudreve/v3/pkg/cluster"
"github.com/cloudreve/Cloudreve/v3/pkg/request"
"github.com/cloudreve/Cloudreve/v3/pkg/serializer"
"github.com/cloudreve/Cloudreve/v3/pkg/task"
testMock "github.com/stretchr/testify/mock"
"io"
)
type NodePoolMock struct {
@@ -151,11 +149,3 @@ func (t TaskPoolMock) Add(num int) {
func (t TaskPoolMock) Submit(job task.Job) {
t.Called(job)
}
type RequestMock struct {
testMock.Mock
}
func (r RequestMock) Request(method, target string, body io.Reader, opts ...request.Option) *request.Response {
return r.Called(method, target, body, opts).Get(0).(*request.Response)
}

View File

@@ -0,0 +1,15 @@
package controllermock
import (
"github.com/cloudreve/Cloudreve/v3/pkg/request"
"github.com/stretchr/testify/mock"
"io"
)
type RequestMock struct {
mock.Mock
}
func (r RequestMock) Request(method, target string, body io.Reader, opts ...request.Option) *request.Response {
return r.Called(method, target, body, opts).Get(0).(*request.Response)
}