summaryrefslogtreecommitdiffstats
path: root/jobs/server_test.go
blob: 3b5ef6f3dfee3c8ce1c97caefe123a1569fc8b26 (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
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package jobs

import (
	"testing"

	"github.com/mattermost/mattermost-server/model"
	"github.com/mattermost/mattermost-server/store"
	"github.com/mattermost/mattermost-server/store/storetest"
	"github.com/mattermost/mattermost-server/utils"
)

func TestJobServer_LoadLicense(t *testing.T) {
	if utils.T == nil {
		utils.TranslationsPreInit()
	}

	mockStore := &storetest.Store{}
	defer mockStore.AssertExpectations(t)

	server := &JobServer{
		Store: mockStore,
	}

	mockStore.SystemStore.On("Get").Return(storetest.NewStoreChannel(store.StoreResult{
		Data: model.StringMap{
			model.SYSTEM_ACTIVE_LICENSE_ID: "thelicenseid00000000000000",
		},
	}))
	mockStore.LicenseStore.On("Get", "thelicenseid00000000000000").Return(storetest.NewStoreChannel(store.StoreResult{
		Data: &model.LicenseRecord{
			Id: "thelicenseid00000000000000",
		},
	}))

	server.LoadLicense()
}