summaryrefslogtreecommitdiffstats
path: root/models/issue_milestone_test.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-12-18 06:06:51 -0800
committerLauris BH <lauris@nix.lv>2017-12-18 16:06:51 +0200
commit0e384c6376ceb8fb7eb03636ba44c8aea338ad7a (patch)
tree7ceb927f0e33b21062828dab3695987fc1f65392 /models/issue_milestone_test.go
parent9a0e2a8b074d209b043b8d9e3d16f1ce4cdcab2d (diff)
downloadgitea-0e384c6376ceb8fb7eb03636ba44c8aea338ad7a.tar.gz
gitea-0e384c6376ceb8fb7eb03636ba44c8aea338ad7a.zip
Check ignored errors for issue and milestone count (#3213)
Diffstat (limited to 'models/issue_milestone_test.go')
-rw-r--r--models/issue_milestone_test.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/models/issue_milestone_test.go b/models/issue_milestone_test.go
index e0bfe11df1..f7987d45ad 100644
--- a/models/issue_milestone_test.go
+++ b/models/issue_milestone_test.go
@@ -146,31 +146,42 @@ func TestCountRepoMilestones(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
test := func(repoID int64) {
repo := AssertExistsAndLoadBean(t, &Repository{ID: repoID}).(*Repository)
- assert.EqualValues(t, repo.NumMilestones, countRepoMilestones(x, repoID))
+ count, err := countRepoMilestones(x, repoID)
+ assert.NoError(t, err)
+ assert.EqualValues(t, repo.NumMilestones, count)
}
test(1)
test(2)
test(3)
- assert.EqualValues(t, 0, countRepoMilestones(x, NonexistentID))
+
+ count, err := countRepoMilestones(x, NonexistentID)
+ assert.NoError(t, err)
+ assert.EqualValues(t, 0, count)
}
func TestCountRepoClosedMilestones(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
test := func(repoID int64) {
repo := AssertExistsAndLoadBean(t, &Repository{ID: repoID}).(*Repository)
- assert.EqualValues(t, repo.NumClosedMilestones, CountRepoClosedMilestones(repoID))
+ count, err := CountRepoClosedMilestones(repoID)
+ assert.NoError(t, err)
+ assert.EqualValues(t, repo.NumClosedMilestones, count)
}
test(1)
test(2)
test(3)
- assert.EqualValues(t, 0, countRepoMilestones(x, NonexistentID))
+
+ count, err := CountRepoClosedMilestones(NonexistentID)
+ assert.NoError(t, err)
+ assert.EqualValues(t, 0, count)
}
func TestMilestoneStats(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())
test := func(repoID int64) {
repo := AssertExistsAndLoadBean(t, &Repository{ID: repoID}).(*Repository)
- open, closed := MilestoneStats(repoID)
+ open, closed, err := MilestoneStats(repoID)
+ assert.NoError(t, err)
assert.EqualValues(t, repo.NumMilestones-repo.NumClosedMilestones, open)
assert.EqualValues(t, repo.NumClosedMilestones, closed)
}
@@ -178,7 +189,8 @@ func TestMilestoneStats(t *testing.T) {
test(2)
test(3)
- open, closed := MilestoneStats(NonexistentID)
+ open, closed, err := MilestoneStats(NonexistentID)
+ assert.NoError(t, err)
assert.EqualValues(t, 0, open)
assert.EqualValues(t, 0, closed)
}