github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+incompatible/api4/webrtc_test.go (about) 1 // Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package api4 5 6 import ( 7 "testing" 8 9 "github.com/mattermost/mattermost-server/model" 10 ) 11 12 func TestGetWebrtcToken(t *testing.T) { 13 if testing.Short() { 14 t.SkipNow() 15 } 16 17 th := Setup().InitBasic().InitSystemAdmin() 18 defer th.TearDown() 19 Client := th.Client 20 21 enableWebrtc := *th.App.Config().WebrtcSettings.Enable 22 defer func() { 23 th.App.UpdateConfig(func(cfg *model.Config) { *cfg.WebrtcSettings.Enable = enableWebrtc }) 24 }() 25 th.App.UpdateConfig(func(cfg *model.Config) { *cfg.WebrtcSettings.Enable = false }) 26 27 _, resp := Client.GetWebrtcToken() 28 CheckNotImplementedStatus(t, resp) 29 30 Client.Logout() 31 _, resp = Client.GetWebrtcToken() 32 CheckUnauthorizedStatus(t, resp) 33 }