summaryrefslogtreecommitdiffstats
path: root/model/license_test.go
blob: 25c74a2e3c928a43d1e53ac4d028b21886750261 (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
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package model

import (
	"testing"
)

func TestLicenseExpired(t *testing.T) {
	l1 := License{}
	l1.ExpiresAt = GetMillis() - 1000
	if !l1.IsExpired() {
		t.Fatal("license should be expired")
	}

	l1.ExpiresAt = GetMillis() + 10000
	if l1.IsExpired() {
		t.Fatal("license should not be expired")
	}
}

func TestLicenseStarted(t *testing.T) {
	l1 := License{}
	l1.StartsAt = GetMillis() - 1000
	if !l1.IsStarted() {
		t.Fatal("license should be started")
	}

	l1.StartsAt = GetMillis() + 10000
	if l1.IsStarted() {
		t.Fatal("license should not be started")
	}
}