summaryrefslogtreecommitdiffstats
path: root/models/issue_user_test.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-11-16 16:53:21 +0800
committerGitHub <noreply@github.com>2021-11-16 16:53:21 +0800
commit81926d61db3dac223a75ea49eab893b25a089587 (patch)
tree627d2f19a008089f3a688e9a94a2cc8d2017afe2 /models/issue_user_test.go
parent23bd7b1211a80aa3b0dcb60ec4a1c0089ff28dd4 (diff)
downloadgitea-81926d61db3dac223a75ea49eab893b25a089587.tar.gz
gitea-81926d61db3dac223a75ea49eab893b25a089587.zip
Decouple unit test, remove intermediate `unittestbridge` package (#17662)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/issue_user_test.go')
-rw-r--r--models/issue_user_test.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/models/issue_user_test.go b/models/issue_user_test.go
index 1a9ae6395b..1be2763703 100644
--- a/models/issue_user_test.go
+++ b/models/issue_user_test.go
@@ -15,7 +15,7 @@ import (
func Test_newIssueUsers(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- repo := db.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
+ repo := unittest.AssertExistsAndLoadBean(t, &Repository{ID: 1}).(*Repository)
newIssue := &Issue{
RepoID: repo.ID,
PosterID: 4,
@@ -25,35 +25,35 @@ func Test_newIssueUsers(t *testing.T) {
}
// artificially insert new issue
- db.AssertSuccessfulInsert(t, newIssue)
+ unittest.AssertSuccessfulInsert(t, newIssue)
assert.NoError(t, newIssueUsers(db.GetEngine(db.DefaultContext), repo, newIssue))
// issue_user table should now have entries for new issue
- db.AssertExistsAndLoadBean(t, &IssueUser{IssueID: newIssue.ID, UID: newIssue.PosterID})
- db.AssertExistsAndLoadBean(t, &IssueUser{IssueID: newIssue.ID, UID: repo.OwnerID})
+ unittest.AssertExistsAndLoadBean(t, &IssueUser{IssueID: newIssue.ID, UID: newIssue.PosterID})
+ unittest.AssertExistsAndLoadBean(t, &IssueUser{IssueID: newIssue.ID, UID: repo.OwnerID})
}
func TestUpdateIssueUserByRead(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- issue := db.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue)
+ issue := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue)
assert.NoError(t, UpdateIssueUserByRead(4, issue.ID))
- db.AssertExistsAndLoadBean(t, &IssueUser{IssueID: issue.ID, UID: 4}, "is_read=1")
+ unittest.AssertExistsAndLoadBean(t, &IssueUser{IssueID: issue.ID, UID: 4}, "is_read=1")
assert.NoError(t, UpdateIssueUserByRead(4, issue.ID))
- db.AssertExistsAndLoadBean(t, &IssueUser{IssueID: issue.ID, UID: 4}, "is_read=1")
+ unittest.AssertExistsAndLoadBean(t, &IssueUser{IssueID: issue.ID, UID: 4}, "is_read=1")
- assert.NoError(t, UpdateIssueUserByRead(db.NonexistentID, db.NonexistentID))
+ assert.NoError(t, UpdateIssueUserByRead(unittest.NonexistentID, unittest.NonexistentID))
}
func TestUpdateIssueUsersByMentions(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- issue := db.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue)
+ issue := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 1}).(*Issue)
uids := []int64{2, 5}
assert.NoError(t, UpdateIssueUsersByMentions(db.DefaultContext, issue.ID, uids))
for _, uid := range uids {
- db.AssertExistsAndLoadBean(t, &IssueUser{IssueID: issue.ID, UID: uid}, "is_mentioned=1")
+ unittest.AssertExistsAndLoadBean(t, &IssueUser{IssueID: issue.ID, UID: uid}, "is_mentioned=1")
}
}