diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-04-06 18:35:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-06 18:35:10 +0800 |
commit | ee0ea2c5fc9f470512acf3f15834f14f8df9d737 (patch) | |
tree | 077bbea20818621e98d3a46ab01c0be235c2d25c /internal/route/repo | |
parent | 4d7db6e1c108cee234422b34e3252ab217c461cc (diff) |
lfs: add unit test for middleware (#6070)
* Add unit test for `authenticate` middleware
* Add more cases
* Add tests for verifyOID and internalServerError
* Add tests for verifyHeader
* Add tests for authroize
Diffstat (limited to 'internal/route/repo')
-rw-r--r-- | internal/route/repo/webhook_test.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/route/repo/webhook_test.go b/internal/route/repo/webhook_test.go index 02f27b92..182c6eed 100644 --- a/internal/route/repo/webhook_test.go +++ b/internal/route/repo/webhook_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "gogs.io/gogs/internal/db" - "gogs.io/gogs/internal/mock" + "gogs.io/gogs/internal/mocks" ) func Test_isLocalHostname(t *testing.T) { @@ -33,9 +33,12 @@ func Test_isLocalHostname(t *testing.T) { } func Test_validateWebhook(t *testing.T) { - l := mock.NewLocale("en", func(s string, _ ...interface{}) string { - return s - }) + l := &mocks.Locale{ + MockLang: "en", + MockTr: func(s string, _ ...interface{}) string { + return s + }, + } tests := []struct { name string |