Cloudreve/models/migration_test.go

22 lines
388 B
Go
Raw Normal View History

2019-12-04 00:49:28 -05:00
package model
import (
"testing"
"github.com/cloudreve/Cloudreve/v3/pkg/conf"
2019-12-05 04:01:14 -05:00
"github.com/jinzhu/gorm"
2019-12-04 00:49:28 -05:00
"github.com/stretchr/testify/assert"
)
func TestMigration(t *testing.T) {
asserts := assert.New(t)
conf.DatabaseConfig.Type = "sqlite3"
2019-12-05 04:01:14 -05:00
DB, _ = gorm.Open("sqlite3", ":memory:")
2019-12-04 00:49:28 -05:00
asserts.NotPanics(func() {
migration()
})
conf.DatabaseConfig.Type = "mysql"
2019-12-05 04:01:14 -05:00
DB = mockDB
2019-12-04 00:49:28 -05:00
}