You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
772 B

  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package webhook
  5. import (
  6. "testing"
  7. api "code.gitea.io/gitea/modules/structs"
  8. "github.com/stretchr/testify/assert"
  9. "github.com/stretchr/testify/require"
  10. )
  11. func TestGetTelegramIssuesPayload(t *testing.T) {
  12. p := issueTestPayload()
  13. p.Action = api.HookIssueClosed
  14. pl, err := new(TelegramPayload).Issue(p)
  15. require.NoError(t, err)
  16. require.NotNil(t, pl)
  17. 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.(*TelegramPayload).Message)
  18. }