[MM-62179] Fix: mmctl debug error when setting email (#29953)
* only GetUserByEmail if arg is an email * fixing tests * fix typo
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
05ca61c784
Коммит
28c561d643
@@ -66,7 +66,7 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
cmd.Flags().String("autocompleteDesc", autocompleteDesc, "")
|
||||
cmd.Flags().String("autocompleteHint", autocompleteHint, "")
|
||||
|
||||
// createCommandCmdF will call getTeamFromTeamArg, getUserFromUserArg which then calls GetUserByEmail
|
||||
// createCommandCmdF will call getTeamFromTeamArg, getUserFromUserArg which then calls GetUserByUsername
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetTeam(context.TODO(), teamArg, "").
|
||||
@@ -74,7 +74,7 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
GetUserByUsername(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
@@ -122,7 +122,7 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
GetUserByUsername(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
@@ -202,7 +202,7 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
GetUserByUsername(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -253,7 +253,7 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
GetUserByUsername(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -318,7 +318,7 @@ func (s *MmctlUnitTestSuite) TestCommandCreateCmd() {
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), creatorIDArg, "").
|
||||
GetUserByUsername(context.TODO(), creatorIDArg, "").
|
||||
Return(&mockUser, &model.Response{}, nil).
|
||||
Times(1)
|
||||
mockError := errors.New("mock error, simulated error for CreateCommand")
|
||||
@@ -540,7 +540,7 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
"--post=" + strconv.FormatBool(method2Bool(mockCommandModified.Method)),
|
||||
}
|
||||
|
||||
// modifyCommandCmdF will call getCommandById, GetUserByEmail and UpdateCommand
|
||||
// modifyCommandCmdF will call getCommandById, GetUserByUsername and UpdateCommand
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetCommandById(context.TODO(), arg).
|
||||
@@ -548,7 +548,7 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), mockCommandModified.CreatorId, "").
|
||||
GetUserByUsername(context.TODO(), mockCommandModified.CreatorId, "").
|
||||
Return(&model.User{Id: mockCommandModified.CreatorId}, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
@@ -620,11 +620,6 @@ func (s *MmctlUnitTestSuite) TestCommandModifyCmd() {
|
||||
GetCommandById(context.TODO(), arg).
|
||||
Return(&mockCommand, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), bogusUsername, "").
|
||||
Return(nil, &model.Response{}, nil).
|
||||
Times(1)
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.TODO(), bogusUsername, "").
|
||||
|
||||
Ссылка в новой задаче
Block a user