github.com/cs3org/reva/v2@v2.27.7/pkg/publicshare/manager/owncloudsql/mocks/UserConverter.go (about) 1 // Copyright 2018-2022 CERN 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 // In applying this license, CERN does not waive the privileges and immunities 16 // granted to it by virtue of its status as an Intergovernmental Organization 17 // or submit itself to any jurisdiction. 18 19 // Code generated by mockery v2.40.2. DO NOT EDIT. 20 21 package mocks 22 23 import ( 24 context "context" 25 26 mock "github.com/stretchr/testify/mock" 27 28 userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" 29 ) 30 31 // UserConverter is an autogenerated mock type for the UserConverter type 32 type UserConverter struct { 33 mock.Mock 34 } 35 36 type UserConverter_Expecter struct { 37 mock *mock.Mock 38 } 39 40 func (_m *UserConverter) EXPECT() *UserConverter_Expecter { 41 return &UserConverter_Expecter{mock: &_m.Mock} 42 } 43 44 // UserIDToUserName provides a mock function with given fields: ctx, userid 45 func (_m *UserConverter) UserIDToUserName(ctx context.Context, userid *userv1beta1.UserId) (string, error) { 46 ret := _m.Called(ctx, userid) 47 48 if len(ret) == 0 { 49 panic("no return value specified for UserIDToUserName") 50 } 51 52 var r0 string 53 var r1 error 54 if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.UserId) (string, error)); ok { 55 return rf(ctx, userid) 56 } 57 if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.UserId) string); ok { 58 r0 = rf(ctx, userid) 59 } else { 60 r0 = ret.Get(0).(string) 61 } 62 63 if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.UserId) error); ok { 64 r1 = rf(ctx, userid) 65 } else { 66 r1 = ret.Error(1) 67 } 68 69 return r0, r1 70 } 71 72 // UserConverter_UserIDToUserName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UserIDToUserName' 73 type UserConverter_UserIDToUserName_Call struct { 74 *mock.Call 75 } 76 77 // UserIDToUserName is a helper method to define mock.On call 78 // - ctx context.Context 79 // - userid *userv1beta1.UserId 80 func (_e *UserConverter_Expecter) UserIDToUserName(ctx interface{}, userid interface{}) *UserConverter_UserIDToUserName_Call { 81 return &UserConverter_UserIDToUserName_Call{Call: _e.mock.On("UserIDToUserName", ctx, userid)} 82 } 83 84 func (_c *UserConverter_UserIDToUserName_Call) Run(run func(ctx context.Context, userid *userv1beta1.UserId)) *UserConverter_UserIDToUserName_Call { 85 _c.Call.Run(func(args mock.Arguments) { 86 run(args[0].(context.Context), args[1].(*userv1beta1.UserId)) 87 }) 88 return _c 89 } 90 91 func (_c *UserConverter_UserIDToUserName_Call) Return(_a0 string, _a1 error) *UserConverter_UserIDToUserName_Call { 92 _c.Call.Return(_a0, _a1) 93 return _c 94 } 95 96 func (_c *UserConverter_UserIDToUserName_Call) RunAndReturn(run func(context.Context, *userv1beta1.UserId) (string, error)) *UserConverter_UserIDToUserName_Call { 97 _c.Call.Return(run) 98 return _c 99 } 100 101 // UserNameToUserID provides a mock function with given fields: ctx, username 102 func (_m *UserConverter) UserNameToUserID(ctx context.Context, username string) (*userv1beta1.UserId, error) { 103 ret := _m.Called(ctx, username) 104 105 if len(ret) == 0 { 106 panic("no return value specified for UserNameToUserID") 107 } 108 109 var r0 *userv1beta1.UserId 110 var r1 error 111 if rf, ok := ret.Get(0).(func(context.Context, string) (*userv1beta1.UserId, error)); ok { 112 return rf(ctx, username) 113 } 114 if rf, ok := ret.Get(0).(func(context.Context, string) *userv1beta1.UserId); ok { 115 r0 = rf(ctx, username) 116 } else { 117 if ret.Get(0) != nil { 118 r0 = ret.Get(0).(*userv1beta1.UserId) 119 } 120 } 121 122 if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { 123 r1 = rf(ctx, username) 124 } else { 125 r1 = ret.Error(1) 126 } 127 128 return r0, r1 129 } 130 131 // UserConverter_UserNameToUserID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UserNameToUserID' 132 type UserConverter_UserNameToUserID_Call struct { 133 *mock.Call 134 } 135 136 // UserNameToUserID is a helper method to define mock.On call 137 // - ctx context.Context 138 // - username string 139 func (_e *UserConverter_Expecter) UserNameToUserID(ctx interface{}, username interface{}) *UserConverter_UserNameToUserID_Call { 140 return &UserConverter_UserNameToUserID_Call{Call: _e.mock.On("UserNameToUserID", ctx, username)} 141 } 142 143 func (_c *UserConverter_UserNameToUserID_Call) Run(run func(ctx context.Context, username string)) *UserConverter_UserNameToUserID_Call { 144 _c.Call.Run(func(args mock.Arguments) { 145 run(args[0].(context.Context), args[1].(string)) 146 }) 147 return _c 148 } 149 150 func (_c *UserConverter_UserNameToUserID_Call) Return(_a0 *userv1beta1.UserId, _a1 error) *UserConverter_UserNameToUserID_Call { 151 _c.Call.Return(_a0, _a1) 152 return _c 153 } 154 155 func (_c *UserConverter_UserNameToUserID_Call) RunAndReturn(run func(context.Context, string) (*userv1beta1.UserId, error)) *UserConverter_UserNameToUserID_Call { 156 _c.Call.Return(run) 157 return _c 158 } 159 160 // NewUserConverter creates a new instance of UserConverter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 161 // The first argument is typically a *testing.T value. 162 func NewUserConverter(t interface { 163 mock.TestingT 164 Cleanup(func()) 165 }) *UserConverter { 166 mock := &UserConverter{} 167 mock.Mock.Test(t) 168 169 t.Cleanup(func() { mock.AssertExpectations(t) }) 170 171 return mock 172 }