summaryrefslogtreecommitdiffstats
path: root/api4/webrtc_test.go
blob: 660bb6f6232d59583006056dfe369c11154cae10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package api4

import (
	"github.com/mattermost/mattermost-server/model"
	"testing"
)

func TestGetWebrtcToken(t *testing.T) {
	if testing.Short() {
		t.SkipNow()
	}

	th := Setup().InitBasic().InitSystemAdmin()
	defer th.TearDown()
	Client := th.Client

	enableWebrtc := *th.App.Config().WebrtcSettings.Enable
	defer func() {
		th.App.UpdateConfig(func(cfg *model.Config) { *cfg.WebrtcSettings.Enable = enableWebrtc })
	}()
	th.App.UpdateConfig(func(cfg *model.Config) { *cfg.WebrtcSettings.Enable = false })

	_, resp := Client.GetWebrtcToken()
	CheckNotImplementedStatus(t, resp)

	Client.Logout()
	_, resp = Client.GetWebrtcToken()
	CheckUnauthorizedStatus(t, resp)
}