summaryrefslogtreecommitdiffstats
path: root/models/webhook_test.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-08-12 14:43:08 +0200
committerGitHub <noreply@github.com>2021-08-12 14:43:08 +0200
commit2289580bb7ef8dfa4124c2b3bfb89897dbb35f46 (patch)
treee68aae604bb3d738b44156504a1415adaf042c68 /models/webhook_test.go
parentca13e1d56c561f72cf8ad251fe61b1898abfec51 (diff)
downloadgitea-2289580bb7ef8dfa4124c2b3bfb89897dbb35f46.tar.gz
gitea-2289580bb7ef8dfa4124c2b3bfb89897dbb35f46.zip
[API] generalize list header (#16551)
* Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
Diffstat (limited to 'models/webhook_test.go')
-rw-r--r--models/webhook_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/models/webhook_test.go b/models/webhook_test.go
index 84520666c0..625d643856 100644
--- a/models/webhook_test.go
+++ b/models/webhook_test.go
@@ -11,6 +11,7 @@ import (
"code.gitea.io/gitea/modules/json"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/util"
"github.com/stretchr/testify/assert"
)
@@ -118,7 +119,7 @@ func TestGetWebhookByOrgID(t *testing.T) {
func TestGetActiveWebhooksByRepoID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- hooks, err := GetActiveWebhooksByRepoID(1)
+ hooks, err := ListWebhooksByOpts(&ListWebhookOptions{RepoID: 1, IsActive: util.OptionalBoolTrue})
assert.NoError(t, err)
if assert.Len(t, hooks, 1) {
assert.Equal(t, int64(1), hooks[0].ID)
@@ -128,7 +129,7 @@ func TestGetActiveWebhooksByRepoID(t *testing.T) {
func TestGetWebhooksByRepoID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- hooks, err := GetWebhooksByRepoID(1, ListOptions{})
+ hooks, err := ListWebhooksByOpts(&ListWebhookOptions{RepoID: 1})
assert.NoError(t, err)
if assert.Len(t, hooks, 2) {
assert.Equal(t, int64(1), hooks[0].ID)
@@ -138,7 +139,7 @@ func TestGetWebhooksByRepoID(t *testing.T) {
func TestGetActiveWebhooksByOrgID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- hooks, err := GetActiveWebhooksByOrgID(3)
+ hooks, err := ListWebhooksByOpts(&ListWebhookOptions{OrgID: 3, IsActive: util.OptionalBoolTrue})
assert.NoError(t, err)
if assert.Len(t, hooks, 1) {
assert.Equal(t, int64(3), hooks[0].ID)
@@ -148,7 +149,7 @@ func TestGetActiveWebhooksByOrgID(t *testing.T) {
func TestGetWebhooksByOrgID(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
- hooks, err := GetWebhooksByOrgID(3, ListOptions{})
+ hooks, err := ListWebhooksByOpts(&ListWebhookOptions{OrgID: 3})
assert.NoError(t, err)
if assert.Len(t, hooks, 1) {
assert.Equal(t, int64(3), hooks[0].ID)