diff options
author | Chris <ccbrown112@gmail.com> | 2018-02-07 16:20:51 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-07 16:20:51 -0600 |
commit | 0f703a3368a0b16fcd48b474377f0dbd2144f366 (patch) | |
tree | 4928199b534de6e1d42d8057c70ebe626b237d4a /model | |
parent | eff65aa05c74e93533c2504b8141b0474011e68c (diff) | |
download | chat-0f703a3368a0b16fcd48b474377f0dbd2144f366.tar.gz chat-0f703a3368a0b16fcd48b474377f0dbd2144f366.tar.bz2 chat-0f703a3368a0b16fcd48b474377f0dbd2144f366.zip |
Eliminate utils.SetLicense calls (#8217)
* eliminate utils.SetLicense calls
* test fix
* another test fix
* more test fixes
Diffstat (limited to 'model')
-rw-r--r-- | model/license.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/model/license.go b/model/license.go index f96cba06c..942a18d55 100644 --- a/model/license.go +++ b/model/license.go @@ -173,6 +173,25 @@ func (l *License) ToJson() string { return string(b) } +// NewTestLicense returns a license that expires in the future and has the given features. +func NewTestLicense(features ...string) *License { + ret := &License{ + ExpiresAt: GetMillis() + 90*24*60*60*1000, + Customer: &Customer{}, + Features: &Features{}, + } + ret.Features.SetDefaults() + + featureMap := map[string]bool{} + for _, feature := range features { + featureMap[feature] = true + } + featureJson, _ := json.Marshal(featureMap) + json.Unmarshal(featureJson, &ret.Features) + + return ret +} + func LicenseFromJson(data io.Reader) *License { var o *License json.NewDecoder(data).Decode(&o) |