summaryrefslogtreecommitdiffstats
path: root/models/models_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-03-21 09:38:54 +0800
committertechknowlogick <matti@mdranta.net>2019-03-20 21:38:54 -0400
commit91dcccf72d15d9d6dbe9c0cc5c5d33c082225cde (patch)
tree2b97fb34e12dad497c4cf7b994e540d247907096 /models/models_test.go
parent75601a8cbc7b1c2bd9cbc21bca49f89ff3db8445 (diff)
downloadgitea-91dcccf72d15d9d6dbe9c0cc5c5d33c082225cde.tar.gz
gitea-91dcccf72d15d9d6dbe9c0cc5c5d33c082225cde.zip
fix dump table name error and add some test for dump database (#6394)
Diffstat (limited to 'models/models_test.go')
-rw-r--r--models/models_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/models/models_test.go b/models/models_test.go
index 7016fdb4b7..6df3b4e048 100644
--- a/models/models_test.go
+++ b/models/models_test.go
@@ -6,6 +6,9 @@
package models
import (
+ "io/ioutil"
+ "os"
+ "path/filepath"
"testing"
"github.com/stretchr/testify/assert"
@@ -93,3 +96,14 @@ func Test_getPostgreSQLConnectionString(t *testing.T) {
assert.Equal(t, test.Output, connStr)
}
}
+
+func TestDumpDatabase(t *testing.T) {
+ assert.NoError(t, PrepareTestDatabase())
+
+ dir, err := ioutil.TempDir(os.TempDir(), "dump")
+ assert.NoError(t, err)
+
+ for _, dbType := range supportedDatabases {
+ assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
+ }
+}