mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	Follow wxiaoguang's suggestion
This commit is contained in:
		| @@ -13,13 +13,6 @@ import ( | |||||||
| 	"github.com/stretchr/testify/assert" | 	"github.com/stretchr/testify/assert" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestApplicationTableName(t *testing.T) { |  | ||||||
| 	e := unittest.GetXORMEngine() |  | ||||||
| 	tableInfo, err := e.TableInfo(new(auth_model.OAuth2Application)) |  | ||||||
| 	assert.NoError(t, err) |  | ||||||
| 	assert.EqualValues(t, "oauth2_application", tableInfo.Name) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func TestOAuth2Application_GenerateClientSecret(t *testing.T) { | func TestOAuth2Application_GenerateClientSecret(t *testing.T) { | ||||||
| 	assert.NoError(t, unittest.PrepareTestDatabase()) | 	assert.NoError(t, unittest.PrepareTestDatabase()) | ||||||
| 	app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1}) | 	app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1}) | ||||||
|   | |||||||
| @@ -7,12 +7,16 @@ import ( | |||||||
| 	"xorm.io/xorm" | 	"xorm.io/xorm" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | type oAuth2Application struct { | ||||||
|  | 	ID                 int64 | ||||||
|  | 	ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"` | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (oAuth2Application) TableName() string { | ||||||
|  | 	return "oauth2_application" | ||||||
|  | } | ||||||
|  |  | ||||||
| // AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true | // AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true | ||||||
| func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error { | func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error { | ||||||
| 	type OAuth2Application struct { | 	return x.Sync(new(oAuth2Application)) | ||||||
| 		ID                 int64 |  | ||||||
| 		ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"` |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	return x.Table("oauth2_application").Sync(new(OAuth2Application)) |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user