aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/api_issue_reaction_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 /integrations/api_issue_reaction_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 'integrations/api_issue_reaction_test.go')
-rw-r--r--integrations/api_issue_reaction_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/integrations/api_issue_reaction_test.go b/integrations/api_issue_reaction_test.go
index d064f48854..4591f8fa8c 100644
--- a/integrations/api_issue_reaction_test.go
+++ b/integrations/api_issue_reaction_test.go
@@ -11,7 +11,7 @@ import (
"time"
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
@@ -21,14 +21,14 @@ import (
func TestAPIIssuesReactions(t *testing.T) {
defer prepareTestEnv(t)()
- issue := db.AssertExistsAndLoadBean(t, &models.Issue{ID: 1}).(*models.Issue)
+ issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: 1}).(*models.Issue)
_ = issue.LoadRepo()
- owner := db.AssertExistsAndLoadBean(t, &models.User{ID: issue.Repo.OwnerID}).(*models.User)
+ owner := unittest.AssertExistsAndLoadBean(t, &models.User{ID: issue.Repo.OwnerID}).(*models.User)
session := loginUser(t, owner.Name)
token := getTokenForLoggedInUser(t, session)
- user2 := db.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
+ user2 := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/reactions?token=%s",
owner.Name, issue.Repo.Name, issue.Index, token)
@@ -78,17 +78,17 @@ func TestAPIIssuesReactions(t *testing.T) {
func TestAPICommentReactions(t *testing.T) {
defer prepareTestEnv(t)()
- comment := db.AssertExistsAndLoadBean(t, &models.Comment{ID: 2}).(*models.Comment)
+ comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{ID: 2}).(*models.Comment)
_ = comment.LoadIssue()
issue := comment.Issue
_ = issue.LoadRepo()
- owner := db.AssertExistsAndLoadBean(t, &models.User{ID: issue.Repo.OwnerID}).(*models.User)
+ owner := unittest.AssertExistsAndLoadBean(t, &models.User{ID: issue.Repo.OwnerID}).(*models.User)
session := loginUser(t, owner.Name)
token := getTokenForLoggedInUser(t, session)
- user1 := db.AssertExistsAndLoadBean(t, &models.User{ID: 1}).(*models.User)
- user2 := db.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
+ user1 := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 1}).(*models.User)
+ user2 := unittest.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/comments/%d/reactions?token=%s",
owner.Name, issue.Repo.Name, comment.ID, token)