menu-traversals #108

Closed
carlos wants to merge 72 commits from menu-traversals into master
3 changed files with 18 additions and 3 deletions
Showing only changes of commit 2703e6d1df - Show all commits

View File

@ -1,4 +1,4 @@
package enginetest package engine
import ( import (
"context" "context"
@ -22,6 +22,7 @@ var (
) )
func TestEngine(sessionId string) (engine.Engine, func()) { func TestEngine(sessionId string) (engine.Engine, func()) {
var accountService server.AccountServiceInterface
ctx := context.Background() ctx := context.Background()
ctx = context.WithValue(ctx, "SessionId", sessionId) ctx = context.WithValue(ctx, "SessionId", sessionId)
pfp := path.Join(scriptDir, "pp.csv") pfp := path.Join(scriptDir, "pp.csv")
@ -76,8 +77,12 @@ func TestEngine(sessionId string) (engine.Engine, func()) {
os.Exit(1) os.Exit(1)
} }
mockAccountService := server.MockAccountService{} if OnlineTestEnabled {
hl, err := lhs.GetHandler(&mockAccountService) accountService = &server.AccountService{}
} else {
accountService = &server.MockAccountService{}
}
hl, err := lhs.GetHandler(accountService)
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, err.Error()) fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1) os.Exit(1)

5
engine/tag_offline.go Normal file
View File

@ -0,0 +1,5 @@
// +build !online
package engine
const OnlineTestEnabled = false

5
engine/tag_online.go Normal file
View File

@ -0,0 +1,5 @@
// +build online
package engine
const OnlineTestEnabled = true