@@ -146,7 +146,7 @@ func TestCreateAction(t *testing.T) {
146146 {
147147 title : "should return internal error if action service return some error" ,
148148 setup : func (as * mocks.ActionService ) {
149- as .EXPECT ().Create (mock .AnythingOfType ("* context.emptyCtx " ), action.Action {
149+ as .EXPECT ().Create (mock .AnythingOfType ("context.todoCtx " ), action.Action {
150150 ID : testActionMap [testActionID ].ID ,
151151 Name : testActionMap [testActionID ].Name ,
152152 NamespaceID : testActionMap [testActionID ].NamespaceID ,
@@ -164,7 +164,7 @@ func TestCreateAction(t *testing.T) {
164164 {
165165 title : "should return bad request error if namespace id is wrong" ,
166166 setup : func (as * mocks.ActionService ) {
167- as .EXPECT ().Create (mock .AnythingOfType ("* context.emptyCtx " ), action.Action {
167+ as .EXPECT ().Create (mock .AnythingOfType ("context.todoCtx " ), action.Action {
168168 ID : testActionMap [testActionID ].ID ,
169169 Name : testActionMap [testActionID ].Name ,
170170 NamespaceID : testActionMap [testActionID ].NamespaceID ,
@@ -182,7 +182,7 @@ func TestCreateAction(t *testing.T) {
182182 {
183183 title : "should return bad request error if if id is empty" ,
184184 setup : func (as * mocks.ActionService ) {
185- as .EXPECT ().Create (mock .AnythingOfType ("* context.emptyCtx " ), action.Action {
185+ as .EXPECT ().Create (mock .AnythingOfType ("context.todoCtx " ), action.Action {
186186 Name : testActionMap [testActionID ].Name ,
187187 NamespaceID : testActionMap [testActionID ].NamespaceID ,
188188 }).Return (action.Action {}, action .ErrInvalidID )
@@ -198,7 +198,7 @@ func TestCreateAction(t *testing.T) {
198198 {
199199 title : "should return bad request error if if name is empty" ,
200200 setup : func (as * mocks.ActionService ) {
201- as .EXPECT ().Create (mock .AnythingOfType ("* context.emptyCtx " ), action.Action {
201+ as .EXPECT ().Create (mock .AnythingOfType ("context.todoCtx " ), action.Action {
202202 ID : testActionMap [testActionID ].ID ,
203203 NamespaceID : testActionMap [testActionID ].NamespaceID ,
204204 }).Return (action.Action {}, action .ErrInvalidDetail )
@@ -214,7 +214,7 @@ func TestCreateAction(t *testing.T) {
214214 {
215215 title : "should return success if action service return nil error" ,
216216 setup : func (as * mocks.ActionService ) {
217- as .EXPECT ().Create (mock .AnythingOfType ("* context.emptyCtx " ), action.Action {
217+ as .EXPECT ().Create (mock .AnythingOfType ("context.todoCtx " ), action.Action {
218218 ID : testActionMap [testActionID ].ID ,
219219 Name : testActionMap [testActionID ].Name ,
220220 NamespaceID : testActionMap [testActionID ].NamespaceID ,
@@ -246,7 +246,7 @@ func TestCreateAction(t *testing.T) {
246246 tt .setup (mockActionSrv )
247247 }
248248 mockDep := Handler {actionService : mockActionSrv }
249- resp , err := mockDep .CreateAction (context .Background (), tt .req )
249+ resp , err := mockDep .CreateAction (context .TODO (), tt .req )
250250 assert .EqualValues (t , tt .want , resp )
251251 assert .EqualValues (t , tt .err , err )
252252 })
@@ -264,7 +264,7 @@ func TestHandler_GetAction(t *testing.T) {
264264 {
265265 name : "should return internal error if action service return some error" ,
266266 setup : func (as * mocks.ActionService ) {
267- as .EXPECT ().Get (mock .AnythingOfType ("* context.emptyCtx " ), testActionID ).Return (action.Action {}, errors .New ("some error" ))
267+ as .EXPECT ().Get (mock .AnythingOfType ("context.todoCtx " ), testActionID ).Return (action.Action {}, errors .New ("some error" ))
268268 },
269269 request : & shieldv1beta1.GetActionRequest {
270270 Id : testActionID ,
@@ -275,7 +275,7 @@ func TestHandler_GetAction(t *testing.T) {
275275 {
276276 name : "should return not found error if action id not exist" ,
277277 setup : func (as * mocks.ActionService ) {
278- as .EXPECT ().Get (mock .AnythingOfType ("* context.emptyCtx " ), testActionID ).Return (action.Action {}, action .ErrNotExist )
278+ as .EXPECT ().Get (mock .AnythingOfType ("context.todoCtx " ), testActionID ).Return (action.Action {}, action .ErrNotExist )
279279 },
280280 request : & shieldv1beta1.GetActionRequest {
281281 Id : testActionID ,
@@ -286,7 +286,7 @@ func TestHandler_GetAction(t *testing.T) {
286286 {
287287 name : "should return not found error if action id is empty" ,
288288 setup : func (as * mocks.ActionService ) {
289- as .EXPECT ().Get (mock .AnythingOfType ("* context.emptyCtx " ), "" ).Return (action.Action {}, action .ErrInvalidID )
289+ as .EXPECT ().Get (mock .AnythingOfType ("context.todoCtx " ), "" ).Return (action.Action {}, action .ErrInvalidID )
290290 },
291291 request : & shieldv1beta1.GetActionRequest {},
292292 want : nil ,
@@ -295,7 +295,7 @@ func TestHandler_GetAction(t *testing.T) {
295295 {
296296 name : "should return success if action service return nil error" ,
297297 setup : func (as * mocks.ActionService ) {
298- as .EXPECT ().Get (mock .AnythingOfType ("* context.emptyCtx " ), testActionID ).Return (testActionMap [testActionID ], nil )
298+ as .EXPECT ().Get (mock .AnythingOfType ("context.todoCtx " ), testActionID ).Return (testActionMap [testActionID ], nil )
299299 },
300300 request : & shieldv1beta1.GetActionRequest {
301301 Id : testActionID ,
@@ -318,7 +318,7 @@ func TestHandler_GetAction(t *testing.T) {
318318 tt .setup (mockActionSrv )
319319 }
320320 mockDep := Handler {actionService : mockActionSrv }
321- resp , err := mockDep .GetAction (context .Background (), tt .request )
321+ resp , err := mockDep .GetAction (context .TODO (), tt .request )
322322 assert .EqualValues (t , tt .want , resp )
323323 assert .EqualValues (t , tt .wantErr , err )
324324 })
@@ -336,7 +336,7 @@ func TestHandler_UpdateAction(t *testing.T) {
336336 {
337337 name : "should return internal error if action service return some error" ,
338338 setup : func (as * mocks.ActionService ) {
339- as .EXPECT ().Update (mock .AnythingOfType ("* context.emptyCtx " ), testActionID , action.Action {
339+ as .EXPECT ().Update (mock .AnythingOfType ("context.todoCtx " ), testActionID , action.Action {
340340 ID : testActionID ,
341341 Name : testActionMap [testActionID ].Name ,
342342 NamespaceID : testActionMap [testActionID ].NamespaceID ,
@@ -355,7 +355,7 @@ func TestHandler_UpdateAction(t *testing.T) {
355355 {
356356 name : "should return not found error if action id not exist" ,
357357 setup : func (as * mocks.ActionService ) {
358- as .EXPECT ().Update (mock .AnythingOfType ("* context.emptyCtx " ), testActionID , action.Action {
358+ as .EXPECT ().Update (mock .AnythingOfType ("context.todoCtx " ), testActionID , action.Action {
359359 ID : testActionID ,
360360 Name : testActionMap [testActionID ].Name ,
361361 NamespaceID : testActionMap [testActionID ].NamespaceID }).Return (action.Action {}, action .ErrNotExist )
@@ -374,7 +374,7 @@ func TestHandler_UpdateAction(t *testing.T) {
374374 {
375375 name : "should return not found error if action id is empty" ,
376376 setup : func (as * mocks.ActionService ) {
377- as .EXPECT ().Update (mock .AnythingOfType ("* context.emptyCtx " ), "" , action.Action {
377+ as .EXPECT ().Update (mock .AnythingOfType ("context.todoCtx " ), "" , action.Action {
378378 Name : testActionMap [testActionID ].Name ,
379379 NamespaceID : testActionMap [testActionID ].NamespaceID }).Return (action.Action {}, action .ErrInvalidID )
380380 },
@@ -391,7 +391,7 @@ func TestHandler_UpdateAction(t *testing.T) {
391391 {
392392 name : "should return bad request error if namespace id not exist" ,
393393 setup : func (as * mocks.ActionService ) {
394- as .EXPECT ().Update (mock .AnythingOfType ("* context.emptyCtx " ), testActionMap [testActionID ].ID , action.Action {
394+ as .EXPECT ().Update (mock .AnythingOfType ("context.todoCtx " ), testActionMap [testActionID ].ID , action.Action {
395395 ID : testActionID ,
396396 Name : testActionMap [testActionID ].Name ,
397397 NamespaceID : testActionMap [testActionID ].NamespaceID }).Return (action.Action {}, namespace .ErrNotExist )
@@ -410,7 +410,7 @@ func TestHandler_UpdateAction(t *testing.T) {
410410 {
411411 name : "should return bad request error if name is empty" ,
412412 setup : func (as * mocks.ActionService ) {
413- as .EXPECT ().Update (mock .AnythingOfType ("* context.emptyCtx " ), testActionMap [testActionID ].ID , action.Action {
413+ as .EXPECT ().Update (mock .AnythingOfType ("context.todoCtx " ), testActionMap [testActionID ].ID , action.Action {
414414 ID : testActionID ,
415415 NamespaceID : testActionMap [testActionID ].NamespaceID }).Return (action.Action {}, action .ErrInvalidDetail )
416416 },
@@ -427,7 +427,7 @@ func TestHandler_UpdateAction(t *testing.T) {
427427 {
428428 name : "should return success if action service return nil error" ,
429429 setup : func (as * mocks.ActionService ) {
430- as .EXPECT ().Update (mock .AnythingOfType ("* context.emptyCtx " ), testActionMap [testActionID ].ID , action.Action {
430+ as .EXPECT ().Update (mock .AnythingOfType ("context.todoCtx " ), testActionMap [testActionID ].ID , action.Action {
431431 ID : testActionID ,
432432 Name : testActionMap [testActionID ].Name ,
433433 NamespaceID : testActionMap [testActionID ].NamespaceID ,
@@ -459,7 +459,7 @@ func TestHandler_UpdateAction(t *testing.T) {
459459 tt .setup (mockActionSrv )
460460 }
461461 mockDep := Handler {actionService : mockActionSrv }
462- resp , err := mockDep .UpdateAction (context .Background (), tt .request )
462+ resp , err := mockDep .UpdateAction (context .TODO (), tt .request )
463463 assert .EqualValues (t , tt .want , resp )
464464 assert .EqualValues (t , tt .wantErr , err )
465465 })
0 commit comments