2017-04-12 08:27:57 -04:00
|
|
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
2017-04-04 09:21:32 -07:00
|
|
|
// See License.txt for license information.
|
|
|
|
|
|
|
|
|
|
package app
|
|
|
|
|
|
|
|
|
|
import (
|
2017-09-06 23:05:10 -07:00
|
|
|
//"github.com/mattermost/mattermost-server/model"
|
2017-04-04 09:21:32 -07:00
|
|
|
"testing"
|
2017-09-06 17:12:54 -05:00
|
|
|
|
2017-09-06 23:05:10 -07:00
|
|
|
"github.com/mattermost/mattermost-server/utils"
|
2017-04-04 09:21:32 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestLoadLicense(t *testing.T) {
|
2017-09-12 09:19:52 -05:00
|
|
|
th := Setup()
|
2017-04-04 09:21:32 -07:00
|
|
|
|
2017-09-12 09:19:52 -05:00
|
|
|
th.App.LoadLicense()
|
2017-08-16 09:51:45 -07:00
|
|
|
if utils.IsLicensed() {
|
2017-04-04 09:21:32 -07:00
|
|
|
t.Fatal("shouldn't have a valid license")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestSaveLicense(t *testing.T) {
|
2017-09-12 09:19:52 -05:00
|
|
|
th := Setup()
|
2017-04-04 09:21:32 -07:00
|
|
|
|
|
|
|
|
b1 := []byte("junk")
|
|
|
|
|
|
2017-09-12 09:19:52 -05:00
|
|
|
if _, err := th.App.SaveLicense(b1); err == nil {
|
2017-04-04 09:21:32 -07:00
|
|
|
t.Fatal("shouldn't have saved license")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestRemoveLicense(t *testing.T) {
|
2017-09-12 09:19:52 -05:00
|
|
|
th := Setup()
|
2017-04-04 09:21:32 -07:00
|
|
|
|
2017-09-12 09:19:52 -05:00
|
|
|
if err := th.App.RemoveLicense(); err != nil {
|
2017-04-04 09:21:32 -07:00
|
|
|
t.Fatal("should have removed license")
|
|
|
|
|
}
|
|
|
|
|
}
|