aboutsummaryrefslogtreecommitdiffstats
path: root/modules/webhook
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webhook')
-rw-r--r--modules/webhook/dingtalk_test.go4
-rw-r--r--modules/webhook/matrix_test.go14
-rw-r--r--modules/webhook/slack_test.go12
-rw-r--r--modules/webhook/telegram_test.go2
4 files changed, 16 insertions, 16 deletions
diff --git a/modules/webhook/dingtalk_test.go b/modules/webhook/dingtalk_test.go
index f50cb9a587..4cb7a913e6 100644
--- a/modules/webhook/dingtalk_test.go
+++ b/modules/webhook/dingtalk_test.go
@@ -17,14 +17,14 @@ func TestGetDingTalkIssuesPayload(t *testing.T) {
p.Action = api.HookIssueOpened
pl, err := getDingtalkIssuesPayload(p)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "#2 crash", pl.ActionCard.Title)
assert.Equal(t, "[test/repo] Issue opened: #2 crash by user1\r\n\r\n", pl.ActionCard.Text)
p.Action = api.HookIssueClosed
pl, err = getDingtalkIssuesPayload(p)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "#2 crash", pl.ActionCard.Title)
assert.Equal(t, "[test/repo] Issue closed: #2 crash by user1\r\n\r\n", pl.ActionCard.Text)
diff --git a/modules/webhook/matrix_test.go b/modules/webhook/matrix_test.go
index cfe234f850..4e8b878ad4 100644
--- a/modules/webhook/matrix_test.go
+++ b/modules/webhook/matrix_test.go
@@ -20,14 +20,14 @@ func TestMatrixIssuesPayloadOpened(t *testing.T) {
p.Action = api.HookIssueOpened
pl, err := getMatrixIssuesPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Issue opened: [#2 crash](http://localhost:3000/test/repo/issues/2) by [user1](https://try.gitea.io/user1)", pl.Body)
assert.Equal(t, "[<a href=\"http://localhost:3000/test/repo\">test/repo</a>] Issue opened: <a href=\"http://localhost:3000/test/repo/issues/2\">#2 crash</a> by <a href=\"https://try.gitea.io/user1\">user1</a>", pl.FormattedBody)
p.Action = api.HookIssueClosed
pl, err = getMatrixIssuesPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Issue closed: [#2 crash](http://localhost:3000/test/repo/issues/2) by [user1](https://try.gitea.io/user1)", pl.Body)
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>", pl.FormattedBody)
@@ -39,7 +39,7 @@ func TestMatrixIssueCommentPayload(t *testing.T) {
sl := &MatrixMeta{}
pl, err := getMatrixIssueCommentPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] New comment on issue [#2 crash](http://localhost:3000/test/repo/issues/2) by [user1](https://try.gitea.io/user1)", pl.Body)
@@ -52,7 +52,7 @@ func TestMatrixPullRequestCommentPayload(t *testing.T) {
sl := &MatrixMeta{}
pl, err := getMatrixIssueCommentPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] New comment on pull request [#2 Fix bug](http://localhost:3000/test/repo/pulls/2) by [user1](https://try.gitea.io/user1)", pl.Body)
@@ -65,7 +65,7 @@ func TestMatrixReleasePayload(t *testing.T) {
sl := &MatrixMeta{}
pl, err := getMatrixReleasePayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Release created: [v1.0](http://localhost:3000/test/repo/src/v1.0) by [user1](https://try.gitea.io/user1)", pl.Body)
@@ -78,7 +78,7 @@ func TestMatrixPullRequestPayload(t *testing.T) {
sl := &MatrixMeta{}
pl, err := getMatrixPullRequestPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[[test/repo](http://localhost:3000/test/repo)] Pull request opened: [#2 Fix bug](http://localhost:3000/test/repo/pulls/12) by [user1](https://try.gitea.io/user1)", pl.Body)
@@ -148,7 +148,7 @@ func TestMatrixHookRequest(t *testing.T) {
}`
req, err := getMatrixHookRequest(h)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, req)
assert.Equal(t, "Bearer dummy_access_token", req.Header.Get("Authorization"))
diff --git a/modules/webhook/slack_test.go b/modules/webhook/slack_test.go
index a418c8e2e2..15503434f8 100644
--- a/modules/webhook/slack_test.go
+++ b/modules/webhook/slack_test.go
@@ -20,13 +20,13 @@ func TestSlackIssuesPayloadOpened(t *testing.T) {
p.Action = api.HookIssueOpened
pl, err := getSlackIssuesPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] Issue opened: <http://localhost:3000/test/repo/issues/2|#2 crash> by <https://try.gitea.io/user1|user1>", pl.Text)
p.Action = api.HookIssueClosed
pl, err = getSlackIssuesPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] Issue closed: <http://localhost:3000/test/repo/issues/2|#2 crash> by <https://try.gitea.io/user1|user1>", pl.Text)
}
@@ -39,7 +39,7 @@ func TestSlackIssueCommentPayload(t *testing.T) {
}
pl, err := getSlackIssueCommentPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] New comment on issue <http://localhost:3000/test/repo/issues/2|#2 crash> by <https://try.gitea.io/user1|user1>", pl.Text)
@@ -53,7 +53,7 @@ func TestSlackPullRequestCommentPayload(t *testing.T) {
}
pl, err := getSlackIssueCommentPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] New comment on pull request <http://localhost:3000/test/repo/pulls/2|#2 Fix bug> by <https://try.gitea.io/user1|user1>", pl.Text)
@@ -67,7 +67,7 @@ func TestSlackReleasePayload(t *testing.T) {
}
pl, err := getSlackReleasePayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] Release created: <http://localhost:3000/test/repo/src/v1.0|v1.0> by <https://try.gitea.io/user1|user1>", pl.Text)
@@ -81,7 +81,7 @@ func TestSlackPullRequestPayload(t *testing.T) {
}
pl, err := getSlackPullRequestPayload(p, sl)
- require.Nil(t, err)
+ require.NoError(t, err)
require.NotNil(t, pl)
assert.Equal(t, "[<http://localhost:3000/test/repo|test/repo>] Pull request opened: <http://localhost:3000/test/repo/pulls/12|#2 Fix bug> by <https://try.gitea.io/user1|user1>", pl.Text)
diff --git a/modules/webhook/telegram_test.go b/modules/webhook/telegram_test.go
index 221dc9843c..1686188b9d 100644
--- a/modules/webhook/telegram_test.go
+++ b/modules/webhook/telegram_test.go
@@ -17,7 +17,7 @@ func TestGetTelegramIssuesPayload(t *testing.T) {
p.Action = api.HookIssueClosed
pl, err := getTelegramIssuesPayload(p)
- require.Nil(t, err)
+ require.NoError(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)