Skip to content

Upgrade xorm to v1.2.2 (#16663) & Add test to ensure that dumping of login sources remains correct (#16847) #16848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ require (
github.com/markbates/goth v1.68.0
github.com/mattn/go-isatty v0.0.13
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-sqlite3 v1.14.7
github.com/mattn/go-sqlite3 v1.14.8
github.com/mholt/archiver/v3 v3.5.0
github.com/microcosm-cc/bluemonday v1.0.15
github.com/miekg/dns v1.1.43 // indirect
@@ -139,7 +139,7 @@ require (
mvdan.cc/xurls/v2 v2.2.0
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
xorm.io/builder v0.3.9
xorm.io/xorm v1.1.2
xorm.io/xorm v1.2.2
)

replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
202 changes: 175 additions & 27 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion models/models.go
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ type Engine interface {
Table(tableNameOrBean interface{}) *xorm.Session
Count(...interface{}) (int64, error)
Decr(column string, arg ...interface{}) *xorm.Session
Delete(interface{}) (int64, error)
Delete(...interface{}) (int64, error)
Exec(...interface{}) (sql.Result, error)
Find(interface{}, ...interface{}) error
Get(interface{}) (bool, error)
26 changes: 26 additions & 0 deletions models/models_test.go
Original file line number Diff line number Diff line change
@@ -8,9 +8,12 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"

"code.gitea.io/gitea/modules/auth/oauth2"
"code.gitea.io/gitea/modules/setting"
"xorm.io/xorm/schemas"

"github.com/stretchr/testify/assert"
)
@@ -32,3 +35,26 @@ func TestDumpDatabase(t *testing.T) {
assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
}
}

func TestDumpLoginSource(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())

loginSourceSchema, err := x.TableInfo(new(LoginSource))
assert.NoError(t, err)

CreateLoginSource(&LoginSource{
Type: LoginOAuth2,
Name: "TestSource",
IsActived: false,
Cfg: &OAuth2Config{
Provider: "TestSourceProvider",
CustomURLMapping: &oauth2.CustomURLMapping{},
},
})

sb := new(strings.Builder)

x.DumpTables([]*schemas.Table{loginSourceSchema}, sb)

assert.Contains(t, sb.String(), `"Provider":"TestSourceProvider"`)
}
32 changes: 32 additions & 0 deletions vendor/github.com/goccy/go-json/.codecov.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions vendor/github.com/goccy/go-json/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions vendor/github.com/goccy/go-json/.golangci.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

236 changes: 236 additions & 0 deletions vendor/github.com/goccy/go-json/CHANGELOG.md
21 changes: 21 additions & 0 deletions vendor/github.com/goccy/go-json/LICENSE
39 changes: 39 additions & 0 deletions vendor/github.com/goccy/go-json/Makefile
529 changes: 529 additions & 0 deletions vendor/github.com/goccy/go-json/README.md

Large diffs are not rendered by default.

68 changes: 68 additions & 0 deletions vendor/github.com/goccy/go-json/color.go
232 changes: 232 additions & 0 deletions vendor/github.com/goccy/go-json/decode.go
13 changes: 13 additions & 0 deletions vendor/github.com/goccy/go-json/docker-compose.yml
323 changes: 323 additions & 0 deletions vendor/github.com/goccy/go-json/encode.go
39 changes: 39 additions & 0 deletions vendor/github.com/goccy/go-json/error.go
3 changes: 3 additions & 0 deletions vendor/github.com/goccy/go-json/go.mod
Empty file.
169 changes: 169 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/array.go
78 changes: 78 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/bool.go
177 changes: 177 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/bytes.go
510 changes: 510 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/compile.go

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go
36 changes: 36 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/compile_race.go
254 changes: 254 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/context.go
158 changes: 158 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/float.go
141 changes: 141 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/func.go
242 changes: 242 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/int.go
458 changes: 458 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/interface.go

Large diffs are not rendered by default.

173 changes: 173 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/map.go
108 changes: 108 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/number.go
15 changes: 15 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/option.go
87 changes: 87 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/ptr.go
294 changes: 294 additions & 0 deletions vendor/github.com/goccy/go-json/internal/decoder/slice.go
Loading