github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/cmd/commands/roles_test.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package commands 5 6 import ( 7 "testing" 8 9 "github.com/mattermost/mattermost-server/api" 10 "github.com/mattermost/mattermost-server/cmd" 11 "github.com/mattermost/mattermost-server/model" 12 ) 13 14 func TestAssignRole(t *testing.T) { 15 th := api.Setup().InitBasic() 16 defer th.TearDown() 17 18 cmd.CheckCommand(t, "roles", "system_admin", th.BasicUser.Email) 19 20 if result := <-th.App.Srv.Store.User().GetByEmail(th.BasicUser.Email); result.Err != nil { 21 t.Fatal() 22 } else { 23 user := result.Data.(*model.User) 24 if user.Roles != "system_admin system_user" { 25 t.Fatal() 26 } 27 } 28 }