diff --git a/engine/engine.go b/engine/engine.go index 9fcff37..f597173 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -1,4 +1,4 @@ -package enginetest +package engine import ( "context" @@ -22,6 +22,7 @@ var ( ) func TestEngine(sessionId string) (engine.Engine, func()) { + var accountService server.AccountServiceInterface ctx := context.Background() ctx = context.WithValue(ctx, "SessionId", sessionId) pfp := path.Join(scriptDir, "pp.csv") @@ -76,8 +77,12 @@ func TestEngine(sessionId string) (engine.Engine, func()) { os.Exit(1) } - mockAccountService := server.MockAccountService{} - hl, err := lhs.GetHandler(&mockAccountService) + if OnlineTestEnabled { + accountService = &server.AccountService{} + } else { + accountService = &server.MockAccountService{} + } + hl, err := lhs.GetHandler(accountService) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) diff --git a/engine/tag_offline.go b/engine/tag_offline.go new file mode 100644 index 0000000..d81433e --- /dev/null +++ b/engine/tag_offline.go @@ -0,0 +1,5 @@ +// +build !online + +package engine + +const OnlineTestEnabled = false \ No newline at end of file diff --git a/engine/tag_online.go b/engine/tag_online.go new file mode 100644 index 0000000..a2ba80b --- /dev/null +++ b/engine/tag_online.go @@ -0,0 +1,5 @@ +// +build online + +package engine + +const OnlineTestEnabled = true \ No newline at end of file