mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
Subscription checks
This commit is contained in:
parent
6e4c5194e2
commit
e116d3b000
20 changed files with 211 additions and 76 deletions
|
@ -2,6 +2,7 @@ package test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/documize/community/domain/store"
|
||||
|
||||
"github.com/documize/community/core/env"
|
||||
"github.com/documize/community/domain"
|
||||
|
@ -13,20 +14,21 @@ import (
|
|||
)
|
||||
|
||||
// SetupTest prepares test environment
|
||||
func SetupTest() (rt *env.Runtime, s *domain.Store, ctx domain.RequestContext) {
|
||||
func SetupTest() (rt *env.Runtime, s *store
|
||||
.Store, ctx domain.RequestContext) {
|
||||
rt, s = startRuntime()
|
||||
ctx = setupContext()
|
||||
return rt, s, ctx
|
||||
}
|
||||
|
||||
func startRuntime() (rt *env.Runtime, s *domain.Store) {
|
||||
func startRuntime() (rt *env.Runtime, s *store.Store) {
|
||||
rt = new(env.Runtime)
|
||||
s = new(domain.Store)
|
||||
s = new(store.Store)
|
||||
|
||||
rt.Log = logging.NewLogger(false)
|
||||
web.Embed = embed.NewEmbedder()
|
||||
|
||||
rt.Product = env.ProdInfo{}
|
||||
rt.Product = env.Product{}
|
||||
rt.Product.Major = "0"
|
||||
rt.Product.Minor = "0"
|
||||
rt.Product.Patch = "0"
|
||||
|
@ -35,9 +37,8 @@ func startRuntime() (rt *env.Runtime, s *domain.Store) {
|
|||
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)
|
||||
rt.Product.License = env.License{}
|
||||
rt.Product.License.Seats = 1
|
||||
rt.Product.License.Valid = true
|
||||
rt.Product.License.Trial = false
|
||||
rt.Product.License.Edition = "Community"
|
||||
rt.Product.License.Edition = env.CommunityEdition
|
||||
|
||||
// parse settings from command line and environment
|
||||
rt.Flags = env.ParseFlags()
|
||||
|
@ -56,7 +57,7 @@ func setupContext() domain.RequestContext {
|
|||
ctx.Administrator = true
|
||||
ctx.Guest = false
|
||||
ctx.Editor = true
|
||||
ctx.Global = true
|
||||
ctx.GlobalAdmin = true
|
||||
ctx.UserID = "test"
|
||||
ctx.OrgID = "test"
|
||||
return ctx
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue