aboutsummaryrefslogtreecommitdiffstats
path: root/models/db/test_fixtures.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/db/test_fixtures.go')
-rw-r--r--models/db/test_fixtures.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/models/db/test_fixtures.go b/models/db/test_fixtures.go
index 1727015133..2715b688ea 100644
--- a/models/db/test_fixtures.go
+++ b/models/db/test_fixtures.go
@@ -17,13 +17,18 @@ import (
var fixtures *testfixtures.Loader
// InitFixtures initialize test fixtures for a test database
-func InitFixtures(dir string, engine ...*xorm.Engine) (err error) {
+func InitFixtures(opts FixturesOptions, engine ...*xorm.Engine) (err error) {
e := x
if len(engine) == 1 {
e = engine[0]
}
- testfiles := testfixtures.Directory(dir)
+ var testfiles func(*testfixtures.Loader) error
+ if opts.Dir != "" {
+ testfiles = testfixtures.Directory(opts.Dir)
+ } else {
+ testfiles = testfixtures.Files(opts.Files...)
+ }
dialect := "unknown"
switch e.Dialect().URI().DBType {
case schemas.POSTGRES: