mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* PLT-5860 Updated copyright date in about modal * PLT-5860 Updated copyright notice in JSX files * PLT-5860 Updated copyright notice in go files * Fixed misc copyright dates * Fixed component snapshots
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package api
|
|
|
|
import (
|
|
"github.com/mattermost/platform/utils"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetLicenceConfig(t *testing.T) {
|
|
th := Setup().InitBasic()
|
|
Client := th.BasicClient
|
|
|
|
if result, err := Client.GetClientLicenceConfig(""); err != nil {
|
|
t.Fatal(err)
|
|
} else {
|
|
cfg := result.Data.(map[string]string)
|
|
|
|
if _, ok := cfg["IsLicensed"]; !ok {
|
|
t.Fatal(cfg)
|
|
}
|
|
|
|
// test etag caching
|
|
if cache_result, err := Client.GetClientLicenceConfig(result.Etag); err != nil {
|
|
t.Fatal(err)
|
|
} else if len(cache_result.Data.(map[string]string)) != 0 {
|
|
t.Log(cache_result.Data)
|
|
t.Fatal("cache should be empty")
|
|
}
|
|
|
|
utils.ClientLicense["IsLicensed"] = "true"
|
|
|
|
if cache_result, err := Client.GetClientLicenceConfig(result.Etag); err != nil {
|
|
t.Fatal(err)
|
|
} else if len(cache_result.Data.(map[string]string)) == 0 {
|
|
t.Fatal("result should not be empty")
|
|
}
|
|
|
|
utils.ClientLicense["SomeFeature"] = "true"
|
|
|
|
if cache_result, err := Client.GetClientLicenceConfig(result.Etag); err != nil {
|
|
t.Fatal(err)
|
|
} else if len(cache_result.Data.(map[string]string)) == 0 {
|
|
t.Fatal("result should not be empty")
|
|
}
|
|
|
|
utils.ClientLicense = map[string]string{"IsLicensed": "false"}
|
|
}
|
|
}
|