Skip to content

Commit 1790f01

Browse files
zeripathlunny
andauthored
Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) (#16848)
* Upgrade xorm to v1.2.2 (#16663) Backport #16663 Fix #16683 * Add test to ensure that dumping of login sources remains correct (#16847) #16831 has occurred because of a missed regression. This PR adds a simple test to try to prevent this occuring again. Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent 0c7927f commit 1790f01

File tree

135 files changed

+42891
-5404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+42891
-5404
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ require (
7878
github.com/markbates/goth v1.68.0
7979
github.com/mattn/go-isatty v0.0.13
8080
github.com/mattn/go-runewidth v0.0.13 // indirect
81-
github.com/mattn/go-sqlite3 v1.14.7
81+
github.com/mattn/go-sqlite3 v1.14.8
8282
github.com/mholt/archiver/v3 v3.5.0
8383
github.com/microcosm-cc/bluemonday v1.0.15
8484
github.com/miekg/dns v1.1.43 // indirect
@@ -139,7 +139,7 @@ require (
139139
mvdan.cc/xurls/v2 v2.2.0
140140
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
141141
xorm.io/builder v0.3.9
142-
xorm.io/xorm v1.1.2
142+
xorm.io/xorm v1.2.2
143143
)
144144

145145
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

go.sum

Lines changed: 175 additions & 27 deletions
Large diffs are not rendered by default.

models/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Engine interface {
3333
Table(tableNameOrBean interface{}) *xorm.Session
3434
Count(...interface{}) (int64, error)
3535
Decr(column string, arg ...interface{}) *xorm.Session
36-
Delete(interface{}) (int64, error)
36+
Delete(...interface{}) (int64, error)
3737
Exec(...interface{}) (sql.Result, error)
3838
Find(interface{}, ...interface{}) error
3939
Get(interface{}) (bool, error)

models/models_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import (
88
"io/ioutil"
99
"os"
1010
"path/filepath"
11+
"strings"
1112
"testing"
1213

14+
"code.gitea.io/gitea/modules/auth/oauth2"
1315
"code.gitea.io/gitea/modules/setting"
16+
"xorm.io/xorm/schemas"
1417

1518
"github.com/stretchr/testify/assert"
1619
)
@@ -32,3 +35,26 @@ func TestDumpDatabase(t *testing.T) {
3235
assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
3336
}
3437
}
38+
39+
func TestDumpLoginSource(t *testing.T) {
40+
assert.NoError(t, PrepareTestDatabase())
41+
42+
loginSourceSchema, err := x.TableInfo(new(LoginSource))
43+
assert.NoError(t, err)
44+
45+
CreateLoginSource(&LoginSource{
46+
Type: LoginOAuth2,
47+
Name: "TestSource",
48+
IsActived: false,
49+
Cfg: &OAuth2Config{
50+
Provider: "TestSourceProvider",
51+
CustomURLMapping: &oauth2.CustomURLMapping{},
52+
},
53+
})
54+
55+
sb := new(strings.Builder)
56+
57+
x.DumpTables([]*schemas.Table{loginSourceSchema}, sb)
58+
59+
assert.Contains(t, sb.String(), `"Provider":"TestSourceProvider"`)
60+
}

vendor/github.com/goccy/go-json/.codecov.yml

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/goccy/go-json/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/goccy/go-json/.golangci.yml

Lines changed: 75 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)