Refactor db package and remove unnecessary DumpTables
(#32930)
This commit is contained in:
parent
7580bd98c1
commit
1c9b022c4d
10 changed files with 247 additions and 221 deletions
|
@ -13,6 +13,8 @@ import (
|
|||
"code.gitea.io/gitea/modules/json"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/schemas"
|
||||
)
|
||||
|
||||
|
@ -54,7 +56,8 @@ func TestDumpAuthSource(t *testing.T) {
|
|||
|
||||
sb := new(strings.Builder)
|
||||
|
||||
db.DumpTables([]*schemas.Table{authSourceSchema}, sb)
|
||||
|
||||
// TODO: this test is quite hacky, it should use a low-level "select" (without model processors) but not a database dump
|
||||
engine := db.GetEngine(db.DefaultContext).(*xorm.Engine)
|
||||
require.NoError(t, engine.DumpTables([]*schemas.Table{authSourceSchema}, sb))
|
||||
assert.Contains(t, sb.String(), `"Provider":"ConvertibleSourceName"`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue