mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-05 12:06:41 +08:00
refactor webhook *NewPost (#20729)
* refactor webhook *NewPost * remove empty values * always show errs.Message * remove utils.IsValidSlackChannel * move IsValidSlackChannel to services/webhook package * binding: handle empty Message case * make IsValidSlackChannel more strict
This commit is contained in:
@ -18,23 +18,6 @@ func TestRemoveUsernameParameterSuffix(t *testing.T) {
|
||||
assert.Equal(t, "", RemoveUsernameParameterSuffix(""))
|
||||
}
|
||||
|
||||
func TestIsValidSlackChannel(t *testing.T) {
|
||||
tt := []struct {
|
||||
channelName string
|
||||
expected bool
|
||||
}{
|
||||
{"gitea", true},
|
||||
{" ", false},
|
||||
{"#", false},
|
||||
{"gitea ", true},
|
||||
{" gitea", true},
|
||||
}
|
||||
|
||||
for _, v := range tt {
|
||||
assert.Equal(t, v.expected, IsValidSlackChannel(v.channelName))
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsExternalURL(t *testing.T) {
|
||||
setting.AppURL = "https://try.gitea.io/"
|
||||
type test struct {
|
||||
|
Reference in New Issue
Block a user