update ut mock anything (#19506)

Signed-off-by: yminer <yminer@vmware.com>
This commit is contained in:
MinerYang 2023-10-31 10:56:31 +08:00 committed by GitHub
parent 7c83e3a4a5
commit 6d817724e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,8 +29,8 @@ import (
func Test_projectReferenceObject(t *testing.T) {
ctl := &project.Controller{}
ctl.On("GetByName", mock.Anything, "library").Return(&proModels.Project{ProjectID: 1}, nil)
ctl.On("GetByName", mock.Anything, "demo").Return(nil, fmt.Errorf("not found"))
ctl.On("GetByName", mock.AnythingOfType("context.todoCtx"), "library").Return(&proModels.Project{ProjectID: 1}, nil)
ctl.On("GetByName", mock.AnythingOfType("context.todoCtx"), "demo").Return(nil, fmt.Errorf("not found"))
originalProjectController := projectController
defer func() {