[MM-62179] Fix: mmctl debug error when setting email (#29953)
* only GetUserByEmail if arg is an email * fixing tests * fix typo
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
05ca61c784
Коммит
28c561d643
@@ -24,12 +24,6 @@ func (s *MmctlUnitTestSuite) TestGenerateTokenForAUserCmd() {
|
||||
mockUser := model.User{Id: "userId1", Email: "user1@example.com", Username: "user1"}
|
||||
mockToken := model.UserAccessToken{Token: "token-id", Description: "token-desc"}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
@@ -58,12 +52,6 @@ func (s *MmctlUnitTestSuite) TestGenerateTokenForAUserCmd() {
|
||||
printer.Clean()
|
||||
|
||||
userArg := "some-text"
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
@@ -87,12 +75,6 @@ func (s *MmctlUnitTestSuite) TestGenerateTokenForAUserCmd() {
|
||||
userArg := "user1"
|
||||
mockUser := model.User{Id: "userId1", Email: "user1@example.com", Username: "user1"}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
@@ -126,12 +108,6 @@ func (s *MmctlUnitTestSuite) TestListTokensOfAUserCmdF() {
|
||||
mockToken1 := model.UserAccessToken{IsActive: true, Id: "token-1-id", Description: "token-1-desc"}
|
||||
mockToken2 := model.UserAccessToken{IsActive: false, Id: "token-2-id", Description: "token-2-desc"}
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), mockUser.Id, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.TODO(), mockUser.Id, "").
|
||||
@@ -204,12 +180,6 @@ func (s *MmctlUnitTestSuite) TestListTokensOfAUserCmdF() {
|
||||
command.Flags().Bool("active", false, "")
|
||||
command.Flags().Bool("inactive", false, "")
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByEmail(context.TODO(), userArg, "").
|
||||
Return(nil, &model.Response{}, errors.New("no user found with the given email")).
|
||||
Times(1)
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
GetUserByUsername(context.TODO(), userArg, "").
|
||||
|
||||
Ссылка в новой задаче
Block a user