summaryrefslogtreecommitdiffstats
path: root/store/sql_license_store_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2016-02-04 13:00:03 -0500
committerJoramWilander <jwawilander@gmail.com>2016-02-04 13:35:44 -0500
commite45282deaa1d78d7ff3a125e9fd11e3fdc120b07 (patch)
treec116beae6abed1b703c481dfd63df36d689a8af5 /store/sql_license_store_test.go
parent7e8389cd0538fb6aff3931fb23714158d3f24449 (diff)
downloadchat-e45282deaa1d78d7ff3a125e9fd11e3fdc120b07.tar.gz
chat-e45282deaa1d78d7ff3a125e9fd11e3fdc120b07.tar.bz2
chat-e45282deaa1d78d7ff3a125e9fd11e3fdc120b07.zip
Move license storage to database
Diffstat (limited to 'store/sql_license_store_test.go')
-rw-r--r--store/sql_license_store_test.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/store/sql_license_store_test.go b/store/sql_license_store_test.go
new file mode 100644
index 000000000..ad24a6af7
--- /dev/null
+++ b/store/sql_license_store_test.go
@@ -0,0 +1,43 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package store
+
+import (
+ "github.com/mattermost/platform/model"
+ "testing"
+)
+
+func TestLicenseStoreSave(t *testing.T) {
+ Setup()
+
+ l1 := model.LicenseRecord{}
+ l1.Id = model.NewId()
+ l1.Bytes = "junk"
+
+ if err := (<-store.License().Save(&l1)).Err; err != nil {
+ t.Fatal("couldn't save license record", err)
+ }
+
+ if err := (<-store.License().Save(&l1)).Err; err != nil {
+ t.Fatal("shouldn't fail on trying to save existing license record", err)
+ }
+}
+
+func TestLicenseStoreGet(t *testing.T) {
+ Setup()
+
+ l1 := model.LicenseRecord{}
+ l1.Id = model.NewId()
+ l1.Bytes = "junk"
+
+ Must(store.License().Save(&l1))
+
+ if r := <-store.License().Get(l1.Id); r.Err != nil {
+ t.Fatal("couldn't get license", r.Err)
+ } else {
+ if r.Data.(*model.LicenseRecord).Bytes != l1.Bytes {
+ t.Fatal("license bytes didn't match")
+ }
+ }
+}