diff options
author | JoramWilander <jwawilander@gmail.com> | 2016-01-13 10:54:12 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2016-01-14 08:24:09 -0500 |
commit | 874d120535a615afddeb80599b7d2d982959ffdb (patch) | |
tree | 226c38cf4d42068733c3c661d3983963a2df4272 /model | |
parent | 9110dd54a15f3d0fcf6f60936e01d816b667b93c (diff) | |
download | chat-874d120535a615afddeb80599b7d2d982959ffdb.tar.gz chat-874d120535a615afddeb80599b7d2d982959ffdb.tar.bz2 chat-874d120535a615afddeb80599b7d2d982959ffdb.zip |
Add some unit tests
Diffstat (limited to 'model')
-rw-r--r-- | model/license.go | 2 | ||||
-rw-r--r-- | model/license_test.go | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/model/license.go b/model/license.go index 7a955e1f8..20e49d668 100644 --- a/model/license.go +++ b/model/license.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package model diff --git a/model/license_test.go b/model/license_test.go new file mode 100644 index 000000000..25c74a2e3 --- /dev/null +++ b/model/license_test.go @@ -0,0 +1,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") + } +} |