mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 08:02:36 +09:00 
			
		
		
		
	Refactor db package and remove unnecessary DumpTables (#32930)
				
					
				
			This commit is contained in:
		@@ -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"`)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user