mirror of
https://codeberg.org/forgejo/forgejo
synced 2025-07-04 16:42:50 +02:00
Compare commits
No commits in common. "35790985d21d0ee0f28cdee202878df10296674f" and "554f3697fc4519b44fb583925259db97eb3a8f5b" have entirely different histories.
35790985d2
...
554f3697fc
4 changed files with 8 additions and 6 deletions
|
@ -16,6 +16,8 @@ import (
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//////////////////// Application
|
||||||
|
|
||||||
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})
|
||||||
|
|
|
@ -9,9 +9,9 @@ import (
|
||||||
|
|
||||||
// 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 {
|
type OAuth2Application struct {
|
||||||
ID int64
|
|
||||||
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
|
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
|
||||||
}
|
}
|
||||||
return x.Sync(new(oauth2Application))
|
|
||||||
|
return x.Sync(new(OAuth2Application))
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,12 @@ import (
|
||||||
|
|
||||||
func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
||||||
// premigration
|
// premigration
|
||||||
type oauth2Application struct {
|
type OAuth2Application struct {
|
||||||
ID int64
|
ID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare and load the testing database
|
// Prepare and load the testing database
|
||||||
x, deferable := base.PrepareTestEnv(t, 0, new(oauth2Application))
|
x, deferable := base.PrepareTestEnv(t, 0, new(OAuth2Application))
|
||||||
defer deferable()
|
defer deferable()
|
||||||
if x == nil || t.Failed() {
|
if x == nil || t.Failed() {
|
||||||
return
|
return
|
||||||
|
@ -36,7 +36,7 @@ func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
got := []ExpectedOAuth2Application{}
|
got := []ExpectedOAuth2Application{}
|
||||||
if err := x.Table("oauth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
|
if err := x.Table("o_auth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue