github.com/psyb0t/mattermost-server@v4.6.1-0.20180125161845-5503a1351abf+incompatible/app/license_test.go (about)

     1  // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package app
     5  
     6  import (
     7  	//"github.com/mattermost/mattermost-server/model"
     8  	"testing"
     9  
    10  	"github.com/mattermost/mattermost-server/utils"
    11  )
    12  
    13  func TestLoadLicense(t *testing.T) {
    14  	th := Setup()
    15  	defer th.TearDown()
    16  
    17  	th.App.LoadLicense()
    18  	if utils.IsLicensed() {
    19  		t.Fatal("shouldn't have a valid license")
    20  	}
    21  }
    22  
    23  func TestSaveLicense(t *testing.T) {
    24  	th := Setup()
    25  	defer th.TearDown()
    26  
    27  	b1 := []byte("junk")
    28  
    29  	if _, err := th.App.SaveLicense(b1); err == nil {
    30  		t.Fatal("shouldn't have saved license")
    31  	}
    32  }
    33  
    34  func TestRemoveLicense(t *testing.T) {
    35  	th := Setup()
    36  	defer th.TearDown()
    37  
    38  	if err := th.App.RemoveLicense(); err != nil {
    39  		t.Fatal("should have removed license")
    40  	}
    41  }