mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Add support for Kopano Webmeetings WebRTC server Add an option to select which WebRTC server to use and add support to use Kopano Webmeetings as backend instead of Janus. If the new configuration is not set, WebRTC assumes Janus is used as backend. * Fixup: remove redundant case. default to janus * Fixup: use GatewayAdminUrl as direct prefix to admin URL entry point * Fixup: consumeAndClose
49 lines
1011 B
Go
49 lines
1011 B
Go
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package model
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestWebrtcInfoResponseToFromJson(t *testing.T) {
|
|
if testing.Short() {
|
|
t.SkipNow()
|
|
}
|
|
|
|
o := WebrtcInfoResponse{Token: NewId(), GatewayUrl: NewId()}
|
|
json := o.ToJson()
|
|
ro := WebrtcInfoResponseFromJson(strings.NewReader(json))
|
|
|
|
CheckString(t, ro.Token, o.Token)
|
|
CheckString(t, ro.GatewayUrl, o.GatewayUrl)
|
|
|
|
invalidJson := `{"wat"`
|
|
r := WebrtcInfoResponseFromJson(strings.NewReader(invalidJson))
|
|
if r != nil {
|
|
t.Fatalf("Should have failed")
|
|
}
|
|
}
|
|
|
|
func TestJanusGatewayResponseFromJson(t *testing.T) {
|
|
if testing.Short() {
|
|
t.SkipNow()
|
|
}
|
|
|
|
// Valid Gateway Response
|
|
s1 := `{"janus": "something"}`
|
|
g1 := JanusGatewayResponseFromJson(strings.NewReader(s1))
|
|
|
|
CheckString(t, g1.Status, "something")
|
|
|
|
// Malformed JSON
|
|
s2 := `{"wat"`
|
|
g2 := JanusGatewayResponseFromJson(strings.NewReader(s2))
|
|
|
|
if g2 != nil {
|
|
t.Fatal("expected nil")
|
|
}
|
|
}
|