aboutsummaryrefslogtreecommitdiffstats
path: root/models/auth/oauth2_test.go
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-14 10:37:24 +0200
committerGitHub <noreply@github.com>2023-10-14 08:37:24 +0000
commit76a85a4ce90fead1eb2b743a42b41617b4592889 (patch)
treeef172bbbc48c24e0d95cd5c689426bad16205a69 /models/auth/oauth2_test.go
parentae419fa49403537725c806a5f3f1e5b274f52eb7 (diff)
downloadgitea-76a85a4ce90fead1eb2b743a42b41617b4592889.tar.gz
gitea-76a85a4ce90fead1eb2b743a42b41617b4592889.zip
Final round of `db.DefaultContext` refactor (#27587)
Last part of #27065
Diffstat (limited to 'models/auth/oauth2_test.go')
-rw-r--r--models/auth/oauth2_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/models/auth/oauth2_test.go b/models/auth/oauth2_test.go
index b8f0bc12c6..122d43098c 100644
--- a/models/auth/oauth2_test.go
+++ b/models/auth/oauth2_test.go
@@ -18,7 +18,7 @@ import (
func TestOAuth2Application_GenerateClientSecret(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})
- secret, err := app.GenerateClientSecret()
+ secret, err := app.GenerateClientSecret(db.DefaultContext)
assert.NoError(t, err)
assert.True(t, len(secret) > 0)
unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1, ClientSecret: app.ClientSecret})
@@ -28,7 +28,7 @@ func BenchmarkOAuth2Application_GenerateClientSecret(b *testing.B) {
assert.NoError(b, unittest.PrepareTestDatabase())
app := unittest.AssertExistsAndLoadBean(b, &auth_model.OAuth2Application{ID: 1})
for i := 0; i < b.N; i++ {
- _, _ = app.GenerateClientSecret()
+ _, _ = app.GenerateClientSecret(db.DefaultContext)
}
}
@@ -78,7 +78,7 @@ func TestOAuth2Application_ContainsRedirect_Slash(t *testing.T) {
func TestOAuth2Application_ValidateClientSecret(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})
- secret, err := app.GenerateClientSecret()
+ secret, err := app.GenerateClientSecret(db.DefaultContext)
assert.NoError(t, err)
assert.True(t, app.ValidateClientSecret([]byte(secret)))
assert.False(t, app.ValidateClientSecret([]byte("fewijfowejgfiowjeoifew")))