summaryrefslogtreecommitdiffstats
path: root/models/models_test.go
blob: 37e9a352f8af13ed7a502885e187d2cfdeeade68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package models

import (
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"

	"code.gitea.io/gitea/modules/setting"

	"github.com/stretchr/testify/assert"
)

func TestDumpDatabase(t *testing.T) {
	assert.NoError(t, PrepareTestDatabase())

	dir, err := ioutil.TempDir(os.TempDir(), "dump")
	assert.NoError(t, err)

	for _, dbName := range setting.SupportedDatabases {
		dbType := setting.GetDBTypeByName(dbName)
		assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
	}
}