mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +02:00
removed embed init() for unit testing
This commit is contained in:
parent
a982af6e79
commit
dba57a15a8
4 changed files with 21 additions and 7 deletions
|
@ -38,7 +38,7 @@ func TestAddSpace(t *testing.T) {
|
|||
return
|
||||
}
|
||||
|
||||
if sp != sp2 {
|
||||
if sp.Name != sp2.Name {
|
||||
t.Errorf("Test Failed, space one (%v) does not match space 2(%v)", sp, sp2)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import (
|
|||
"github.com/documize/community/domain"
|
||||
"github.com/documize/community/edition/boot"
|
||||
"github.com/documize/community/edition/logging"
|
||||
"github.com/documize/community/embed"
|
||||
"github.com/documize/community/server/web"
|
||||
_ "github.com/go-sql-driver/mysql" // testing
|
||||
)
|
||||
|
||||
|
@ -20,7 +22,9 @@ func SetupTest() (rt *env.Runtime, s *domain.Store, ctx domain.RequestContext) {
|
|||
func startRuntime() (rt *env.Runtime, s *domain.Store) {
|
||||
rt = new(env.Runtime)
|
||||
s = new(domain.Store)
|
||||
|
||||
rt.Log = logging.NewLogger()
|
||||
web.Embed = embed.NewEmbedder()
|
||||
|
||||
rt.Product = env.ProdInfo{}
|
||||
rt.Product.Major = "0"
|
||||
|
@ -53,7 +57,7 @@ func setupContext() domain.RequestContext {
|
|||
ctx.Guest = false
|
||||
ctx.Editor = true
|
||||
ctx.Global = true
|
||||
ctx.UserID = "1"
|
||||
ctx.OrgID = "1"
|
||||
ctx.UserID = "test"
|
||||
ctx.OrgID = "test"
|
||||
return ctx
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ import (
|
|||
"github.com/documize/community/domain/section"
|
||||
"github.com/documize/community/edition/boot"
|
||||
"github.com/documize/community/edition/logging"
|
||||
_ "github.com/documize/community/embed" // the compressed front-end code and static data
|
||||
"github.com/documize/community/embed"
|
||||
// _"github.com/documize/community/embed" // the compressed front-end code and static data
|
||||
"github.com/documize/community/server"
|
||||
"github.com/documize/community/server/web"
|
||||
_ "github.com/go-sql-driver/mysql" // the mysql driver is required behind the scenes
|
||||
)
|
||||
|
||||
|
@ -34,6 +36,9 @@ func main() {
|
|||
// wire up logging implementation
|
||||
rt.Log = logging.NewLogger()
|
||||
|
||||
// wire up embedded web assets handler
|
||||
web.Embed = embed.NewEmbedder()
|
||||
|
||||
// product details
|
||||
rt.Product = env.ProdInfo{}
|
||||
rt.Product.Major = "1"
|
||||
|
|
|
@ -17,7 +17,6 @@ package embed
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/documize/community/server/web"
|
||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||
)
|
||||
|
||||
|
@ -38,6 +37,12 @@ func (embedderT) StaticAssetsFileSystem() http.FileSystem {
|
|||
|
||||
var embedder embedderT
|
||||
|
||||
func init() {
|
||||
web.Embed = embedder
|
||||
// NewEmbedder returns embed assets handler instance
|
||||
func NewEmbedder() embedderT {
|
||||
return embedder
|
||||
}
|
||||
|
||||
// func init() {
|
||||
// fmt.Println("firing embed init()")
|
||||
// web.Embed = embedder
|
||||
// }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue