summaryrefslogtreecommitdiffstats
path: root/cmd/commands/user_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-05-11 18:58:03 +0200
committerDerrick Anderson <derrick@andersonwebstudio.com>2018-05-11 12:58:03 -0400
commit527bf9d3d31e23679c65e0fcf9104c321e72f8c3 (patch)
treed64e1e67eb84ad97e4c6d16beeac4c4c75a46629 /cmd/commands/user_test.go
parent4ce37601a15a7af11d33465d1ae92de26f7fa498 (diff)
downloadchat-527bf9d3d31e23679c65e0fcf9104c321e72f8c3.tar.gz
chat-527bf9d3d31e23679c65e0fcf9104c321e72f8c3.tar.bz2
chat-527bf9d3d31e23679c65e0fcf9104c321e72f8c3.zip
[MM-9720] fix bugs when trying to change for a in use email and check the number of parameters (#8772)
Diffstat (limited to 'cmd/commands/user_test.go')
-rw-r--r--cmd/commands/user_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmd/commands/user_test.go b/cmd/commands/user_test.go
index a1081c5d3..8691ac803 100644
--- a/cmd/commands/user_test.go
+++ b/cmd/commands/user_test.go
@@ -104,7 +104,19 @@ func TestChangeUserEmail(t *testing.T) {
// should fail because using an invalid email
require.Error(t, cmd.RunCommand(t, "user", "email", th.BasicUser.Username, "wrong$email.com"))
+ // should fail because missing one parameter
+ require.Error(t, cmd.RunCommand(t, "user", "email", th.BasicUser.Username))
+
+ // should fail because missing both parameters
+ require.Error(t, cmd.RunCommand(t, "user", "email"))
+
+ // should fail because have more than 2 parameters
+ require.Error(t, cmd.RunCommand(t, "user", "email", th.BasicUser.Username, "new@email.com", "extra!"))
+
// should fail because user not found
require.Error(t, cmd.RunCommand(t, "user", "email", "invalidUser", newEmail))
+ // should fail because email already in use
+ require.Error(t, cmd.RunCommand(t, "user", "email", th.BasicUser.Username, th.BasicUser2.Email))
+
}