A fork of Gitea (see branch `mj`) adding Majority Judgment Polls 𐄷 over Issues and Merge Requests. https://git.mieuxvoter.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
774 B

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import (
  6. "io/ioutil"
  7. "os"
  8. "path/filepath"
  9. "testing"
  10. "code.gitea.io/gitea/modules/setting"
  11. "github.com/stretchr/testify/assert"
  12. )
  13. func TestDumpDatabase(t *testing.T) {
  14. assert.NoError(t, PrepareTestDatabase())
  15. dir, err := ioutil.TempDir(os.TempDir(), "dump")
  16. assert.NoError(t, err)
  17. type Version struct {
  18. ID int64 `xorm:"pk autoincr"`
  19. Version int64
  20. }
  21. assert.NoError(t, x.Sync2(new(Version)))
  22. for _, dbName := range setting.SupportedDatabases {
  23. dbType := setting.GetDBTypeByName(dbName)
  24. assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
  25. }
  26. }