diff options
author | ᴜɴᴋɴᴡᴏɴ <u@gogs.io> | 2020-03-22 22:07:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 22:07:22 +0800 |
commit | 22717a1c064511cf37c46af5e650baf7184cf25b (patch) | |
tree | f98bb991145605567f8b43506a7add855db0a90f /internal/mock | |
parent | 82e511ddb1d1e98ebe6b1931766b0835fc066883 (diff) |
webhook: overhaul route handlers (#6002)
* Overual route handlers and fixes #5366
* Merge routes for repo and org
* Inject OrgRepoContext
* DRY validateWebhook
* DRY c.HasError
* Add tests
* Update CHANGELOG
Diffstat (limited to 'internal/mock')
-rw-r--r-- | internal/mock/locale.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/mock/locale.go b/internal/mock/locale.go new file mode 100644 index 00000000..fbd91da1 --- /dev/null +++ b/internal/mock/locale.go @@ -0,0 +1,33 @@ +// Copyright 2020 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package mock + +import ( + "gopkg.in/macaron.v1" +) + +var _ macaron.Locale = (*Locale)(nil) + +// Locale is a mock that implements macaron.Locale. +type Locale struct { + lang string + tr func(string, ...interface{}) string +} + +// NewLocale creates a new mock for macaron.Locale. +func NewLocale(lang string, tr func(string, ...interface{}) string) *Locale { + return &Locale{ + lang: lang, + tr: tr, + } +} + +func (l *Locale) Language() string { + return l.lang +} + +func (l *Locale) Tr(format string, args ...interface{}) string { + return l.tr(format, args...) +} |