diff options
Diffstat (limited to 'cmd/commands/roles_test.go')
-rw-r--r-- | cmd/commands/roles_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cmd/commands/roles_test.go b/cmd/commands/roles_test.go new file mode 100644 index 000000000..1e0a46a4e --- /dev/null +++ b/cmd/commands/roles_test.go @@ -0,0 +1,28 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package commands + +import ( + "testing" + + "github.com/mattermost/mattermost-server/api" + "github.com/mattermost/mattermost-server/cmd" + "github.com/mattermost/mattermost-server/model" +) + +func TestAssignRole(t *testing.T) { + th := api.Setup().InitBasic() + defer th.TearDown() + + cmd.CheckCommand(t, "roles", "system_admin", th.BasicUser.Email) + + if result := <-th.App.Srv.Store.User().GetByEmail(th.BasicUser.Email); result.Err != nil { + t.Fatal() + } else { + user := result.Data.(*model.User) + if user.Roles != "system_admin system_user" { + t.Fatal() + } + } +} |