summaryrefslogtreecommitdiffstats
path: root/models/topic_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/topic_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/topic_test.go')
-rw-r--r--models/topic_test.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/models/topic_test.go b/models/topic_test.go
index 25232eb981..9386a71e35 100644
--- a/models/topic_test.go
+++ b/models/topic_test.go
@@ -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)