diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2021-11-16 16:53:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 16:53:21 +0800 |
commit | 81926d61db3dac223a75ea49eab893b25a089587 (patch) | |
tree | 627d2f19a008089f3a688e9a94a2cc8d2017afe2 /integrations/git_test.go | |
parent | 23bd7b1211a80aa3b0dcb60ec4a1c0089ff28dd4 (diff) | |
download | gitea-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/git_test.go')
-rw-r--r-- | integrations/git_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/integrations/git_test.go b/integrations/git_test.go index 9a264c9448..cf84800eed 100644 --- a/integrations/git_test.go +++ b/integrations/git_test.go @@ -18,7 +18,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/git" "code.gitea.io/gitea/modules/lfs" "code.gitea.io/gitea/modules/setting" @@ -631,7 +631,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB return } - pullNum := db.GetCount(t, &models.PullRequest{}) + pullNum := unittest.GetCount(t, &models.PullRequest{}) t.Run("CreateHeadBranch", doGitCreateBranch(dstPath, headBranch)) @@ -667,8 +667,8 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB if !assert.NoError(t, err) { return } - db.AssertCount(t, &models.PullRequest{}, pullNum+1) - pr1 = db.AssertExistsAndLoadBean(t, &models.PullRequest{ + unittest.AssertCount(t, &models.PullRequest{}, pullNum+1) + pr1 = unittest.AssertExistsAndLoadBean(t, &models.PullRequest{ HeadRepoID: repo.ID, Flow: models.PullRequestFlowAGit, }).(*models.PullRequest) @@ -688,8 +688,8 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB if !assert.NoError(t, err) { return } - db.AssertCount(t, &models.PullRequest{}, pullNum+2) - pr2 = db.AssertExistsAndLoadBean(t, &models.PullRequest{ + unittest.AssertCount(t, &models.PullRequest{}, pullNum+2) + pr2 = unittest.AssertExistsAndLoadBean(t, &models.PullRequest{ HeadRepoID: repo.ID, Index: pr1.Index + 1, Flow: models.PullRequestFlowAGit, @@ -741,7 +741,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB if !assert.NoError(t, err) { return } - db.AssertCount(t, &models.PullRequest{}, pullNum+2) + unittest.AssertCount(t, &models.PullRequest{}, pullNum+2) prMsg, err := doAPIGetPullRequest(*ctx, ctx.Username, ctx.Reponame, pr1.Index)(t) if !assert.NoError(t, err) { return @@ -753,7 +753,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB if !assert.NoError(t, err) { return } - db.AssertCount(t, &models.PullRequest{}, pullNum+2) + unittest.AssertCount(t, &models.PullRequest{}, pullNum+2) prMsg, err = doAPIGetPullRequest(*ctx, ctx.Username, ctx.Reponame, pr2.Index)(t) if !assert.NoError(t, err) { return |