diff options
author | Cornel <cornelk@users.noreply.github.com> | 2019-12-28 16:55:09 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-12-28 08:55:09 +0000 |
commit | 81e63d0714f1539fcd688cf3e216b0eab89e88aa (patch) | |
tree | cddd201be48da86ba309e7d794f8c6becf3c1b05 /modules/webhook/telegram_test.go | |
parent | 10455a88dc28c00f86587266a1ecd736bea63d03 (diff) | |
download | gitea-81e63d0714f1539fcd688cf3e216b0eab89e88aa.tar.gz gitea-81e63d0714f1539fcd688cf3e216b0eab89e88aa.zip |
Refactor webhooks to reduce code duplication (#9422)
* Start webhook refactoring to reduce code duplication
* More webhook refactoring
* Unify webhook release messages
* Fix webhook release link
* Remove sql import
* More webhook refactoring
* More webhook refactoring
* Webhook tests extended
* Fixed issue opened webhook
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Diffstat (limited to 'modules/webhook/telegram_test.go')
-rw-r--r-- | modules/webhook/telegram_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/webhook/telegram_test.go b/modules/webhook/telegram_test.go new file mode 100644 index 0000000000..221dc9843c --- /dev/null +++ b/modules/webhook/telegram_test.go @@ -0,0 +1,24 @@ +// Copyright 2019 The Gitea 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 webhook + +import ( + "testing" + + api "code.gitea.io/gitea/modules/structs" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetTelegramIssuesPayload(t *testing.T) { + p := issueTestPayload() + p.Action = api.HookIssueClosed + + pl, err := getTelegramIssuesPayload(p) + require.Nil(t, err) + require.NotNil(t, pl) + + assert.Equal(t, "[<a href=\"http://localhost:3000/test/repo\">test/repo</a>] Issue closed: <a href=\"http://localhost:3000/test/repo/issues/2\">#2 crash</a> by <a href=\"https://try.gitea.io/user1\">user1</a>\n\n", pl.Message) +} |