Skip to content

Commit b6b5207

Browse files
committed
Add ut.
Change-Id: I79b30a2c5b0cf94230e8ece6cc9b2f9800d57633
1 parent 6b0094a commit b6b5207

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

backend/modules/evaluation/domain/service/file_name

Lines changed: 0 additions & 1 deletion
This file was deleted.

backend/modules/observability/application/task_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ func TestTaskApplication_CreateTask(t *testing.T) {
199199
},
200200
},
201201
TaskStatus: gptr.Of(taskdto.TaskStatusPending),
202+
TaskSource: gptr.Of(taskdto.TaskSourceUser),
202203
}
203204
}
204205

@@ -276,6 +277,19 @@ func TestTaskApplication_CreateTask(t *testing.T) {
276277
return svcMock, auth
277278
},
278279
},
280+
{
281+
name: "error with empty user id",
282+
ctx: session.WithCtxUser(context.Background(), &session.User{ID: "", AppID: 1}),
283+
req: &taskapi.CreateTaskRequest{Task: taskForSuccess},
284+
expectResp: nil,
285+
expectErrCode: obErrorx.UserParseFailedCode,
286+
fieldsBuilder: func(ctrl *gomock.Controller) (svc.ITaskService, rpc.IAuthProvider) {
287+
auth := rpcmock.NewMockIAuthProvider(ctrl)
288+
auth.EXPECT().CheckWorkspacePermission(gomock.Any(), rpc.AuthActionTraceTaskCreate, strconv.FormatInt(123, 10), false).Return(nil)
289+
svcMock := svcmock.NewMockITaskService(ctrl)
290+
return svcMock, auth
291+
},
292+
},
279293
{
280294
name: "success with trace app",
281295
ctx: ctxWithAppID(717152),

0 commit comments

Comments
 (0)