summaryrefslogtreecommitdiffstats
path: root/models/review_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-20 22:08:52 +0800
committerGitHub <noreply@github.com>2022-05-20 22:08:52 +0800
commitfd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch)
tree50038348ec10485f72344f3ac80324e04abc1283 /models/review_test.go
parentd81e31ad7826a81fc7139f329f250594610a274b (diff)
downloadgitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.tar.gz
gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.zip
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
Diffstat (limited to 'models/review_test.go')
-rw-r--r--models/review_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/models/review_test.go b/models/review_test.go
index a4a71cc709..93291f9f57 100644
--- a/models/review_test.go
+++ b/models/review_test.go
@@ -16,12 +16,12 @@ import (
func TestGetReviewByID(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- review, err := GetReviewByID(1)
+ review, err := GetReviewByID(db.DefaultContext, 1)
assert.NoError(t, err)
assert.Equal(t, "Demo Review", review.Content)
assert.Equal(t, ReviewTypeApprove, review.Type)
- _, err = GetReviewByID(23892)
+ _, err = GetReviewByID(db.DefaultContext, 23892)
assert.Error(t, err)
assert.True(t, IsErrReviewNotExist(err), "IsErrReviewNotExist")
}
@@ -61,7 +61,7 @@ func TestReviewType_Icon(t *testing.T) {
func TestFindReviews(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
- reviews, err := FindReviews(FindReviewOptions{
+ reviews, err := FindReviews(db.DefaultContext, FindReviewOptions{
Type: ReviewTypeApprove,
IssueID: 2,
ReviewerID: 1,
@@ -76,14 +76,14 @@ func TestGetCurrentReview(t *testing.T) {
issue := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue)
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User)
- review, err := GetCurrentReview(user, issue)
+ review, err := GetCurrentReview(db.DefaultContext, user, issue)
assert.NoError(t, err)
assert.NotNil(t, review)
assert.Equal(t, ReviewTypePending, review.Type)
assert.Equal(t, "Pending Review", review.Content)
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 7}).(*user_model.User)
- review2, err := GetCurrentReview(user2, issue)
+ review2, err := GetCurrentReview(db.DefaultContext, user2, issue)
assert.Error(t, err)
assert.True(t, IsErrReviewNotExist(err))
assert.Nil(t, review2)
@@ -95,7 +95,7 @@ func TestCreateReview(t *testing.T) {
issue := unittest.AssertExistsAndLoadBean(t, &Issue{ID: 2}).(*Issue)
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}).(*user_model.User)
- review, err := CreateReview(CreateReviewOptions{
+ review, err := CreateReview(db.DefaultContext, CreateReviewOptions{
Content: "New Review",
Type: ReviewTypePending,
Issue: issue,