summaryrefslogtreecommitdiffstats
path: root/models/db/engine.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/db/engine.go')
-rwxr-xr-xmodels/db/engine.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/db/engine.go b/models/db/engine.go
index d1b279e016..e392008020 100755
--- a/models/db/engine.go
+++ b/models/db/engine.go
@@ -153,6 +153,15 @@ func InitEngine(ctx context.Context) (err error) {
return nil
}
+// SetEngine is used by unit test code
+func SetEngine(eng *xorm.Engine) {
+ x = eng
+ DefaultContext = &Context{
+ Context: context.Background(),
+ e: x,
+ }
+}
+
// InitEngineWithMigration initializes a new xorm.Engine
// This function must never call .Sync2() if the provided migration function fails.
// When called from the "doctor" command, the migration function is a version check