mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-31 13:02:52 +09:00
Check ignored errors for issue and milestone count (#3213)
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user