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