add tags to toggle between online and offline tests
This commit is contained in:
parent
86ba03b375
commit
2703e6d1df
@ -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
5
engine/tag_offline.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// +build !online
|
||||||
|
|
||||||
|
package engine
|
||||||
|
|
||||||
|
const OnlineTestEnabled = false
|
5
engine/tag_online.go
Normal file
5
engine/tag_online.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// +build online
|
||||||
|
|
||||||
|
package engine
|
||||||
|
|
||||||
|
const OnlineTestEnabled = true
|
Loading…
Reference in New Issue
Block a user