mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Decouple unit test, remove intermediate unittestbridge
package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@@ -7,7 +7,6 @@ package models
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
@@ -18,9 +17,9 @@ func TestIssueList_LoadRepositories(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
issueList := IssueList{
|
||||
db.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue),
|
||||
db.AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue),
|
||||
db.AssertExistsAndLoadBean(t, &Issue{ID: 4}).(*Issue),
|
||||
unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue),
|
||||
unittest.AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue),
|
||||
unittest.AssertExistsAndLoadBean(t, &Issue{ID: 4}).(*Issue),
|
||||
}
|
||||
|
||||
repos, err := issueList.LoadRepositories()
|
||||
@@ -35,8 +34,8 @@ func TestIssueList_LoadAttributes(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
setting.Service.EnableTimetracking = true
|
||||
issueList := IssueList{
|
||||
db.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue),
|
||||
db.AssertExistsAndLoadBean(t, &Issue{ID: 4}).(*Issue),
|
||||
unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue),
|
||||
unittest.AssertExistsAndLoadBean(t, &Issue{ID: 4}).(*Issue),
|
||||
}
|
||||
|
||||
assert.NoError(t, issueList.LoadAttributes())
|
||||
@@ -44,7 +43,7 @@ func TestIssueList_LoadAttributes(t *testing.T) {
|
||||
assert.EqualValues(t, issue.RepoID, issue.Repo.ID)
|
||||
for _, label := range issue.Labels {
|
||||
assert.EqualValues(t, issue.RepoID, label.RepoID)
|
||||
db.AssertExistsAndLoadBean(t, &IssueLabel{IssueID: issue.ID, LabelID: label.ID})
|
||||
unittest.AssertExistsAndLoadBean(t, &IssueLabel{IssueID: issue.ID, LabelID: label.ID})
|
||||
}
|
||||
if issue.PosterID > 0 {
|
||||
assert.EqualValues(t, issue.PosterID, issue.Poster.ID)
|
||||
|
Reference in New Issue
Block a user