mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	[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
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user