mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-17 14:00:01 +02: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:
parent
ca13e1d56c
commit
2289580bb7
88 changed files with 637 additions and 329 deletions
|
@ -17,17 +17,18 @@ func TestAddTopic(t *testing.T) {
|
|||
|
||||
assert.NoError(t, PrepareTestDatabase())
|
||||
|
||||
topics, err := FindTopics(&FindTopicOptions{})
|
||||
topics, _, err := FindTopics(&FindTopicOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, topics, totalNrOfTopics)
|
||||
|
||||
topics, err = FindTopics(&FindTopicOptions{
|
||||
topics, total, err := FindTopics(&FindTopicOptions{
|
||||
ListOptions: ListOptions{Page: 1, PageSize: 2},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, topics, 2)
|
||||
assert.EqualValues(t, 6, total)
|
||||
|
||||
topics, err = FindTopics(&FindTopicOptions{
|
||||
topics, _, err = FindTopics(&FindTopicOptions{
|
||||
RepoID: 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
@ -35,11 +36,11 @@ func TestAddTopic(t *testing.T) {
|
|||
|
||||
assert.NoError(t, SaveTopics(2, "golang"))
|
||||
repo2NrOfTopics = 1
|
||||
topics, err = FindTopics(&FindTopicOptions{})
|
||||
topics, _, err = FindTopics(&FindTopicOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, topics, totalNrOfTopics)
|
||||
|
||||
topics, err = FindTopics(&FindTopicOptions{
|
||||
topics, _, err = FindTopics(&FindTopicOptions{
|
||||
RepoID: 2,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
@ -52,11 +53,11 @@ func TestAddTopic(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, topic.RepoCount)
|
||||
|
||||
topics, err = FindTopics(&FindTopicOptions{})
|
||||
topics, _, err = FindTopics(&FindTopicOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, topics, totalNrOfTopics)
|
||||
|
||||
topics, err = FindTopics(&FindTopicOptions{
|
||||
topics, _, err = FindTopics(&FindTopicOptions{
|
||||
RepoID: 2,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue