summaryrefslogtreecommitdiffstats
path: root/app/license_test.go
blob: fabd949cfeab82d0fc96f6491648f9146502589b (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
33
34
35
36
37
38
39
40
41
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package app

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

	"github.com/mattermost/mattermost-server/utils"
)

func TestLoadLicense(t *testing.T) {
	a := Global()
	a.Setup()

	a.LoadLicense()
	if utils.IsLicensed() {
		t.Fatal("shouldn't have a valid license")
	}
}

func TestSaveLicense(t *testing.T) {
	a := Global()
	a.Setup()

	b1 := []byte("junk")

	if _, err := a.SaveLicense(b1); err == nil {
		t.Fatal("shouldn't have saved license")
	}
}

func TestRemoveLicense(t *testing.T) {
	a := Global()
	a.Setup()

	if err := a.RemoveLicense(); err != nil {
		t.Fatal("should have removed license")
	}
}