diff options
author | kolaente <konrad@kola-entertainments.de> | 2018-11-22 14:17:36 +0100 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-11-22 15:17:36 +0200 |
commit | 0dcf31ae49707c10c1b14e112e0831e920cb6e16 (patch) | |
tree | fae417a40cfad5dc19d625e797628cc5c6ebbb8f /models/review_test.go | |
parent | cef0f12c51cee9edeb636fd2174f8d4eb00ea955 (diff) | |
download | gitea-0dcf31ae49707c10c1b14e112e0831e920cb6e16.tar.gz gitea-0dcf31ae49707c10c1b14e112e0831e920cb6e16.zip |
Show review summary in pull requests (#5132)
Diffstat (limited to 'models/review_test.go')
-rw-r--r-- | models/review_test.go | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/models/review_test.go b/models/review_test.go index 3c0444e7a3..f8e8086dca 100644 --- a/models/review_test.go +++ b/models/review_test.go @@ -74,7 +74,7 @@ func TestGetCurrentReview(t *testing.T) { assert.Equal(t, ReviewTypePending, review.Type) assert.Equal(t, "Pending Review", review.Content) - user2 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) + user2 := AssertExistsAndLoadBean(t, &User{ID: 7}).(*User) review2, err := GetCurrentReview(user2, issue) assert.Error(t, err) assert.True(t, IsErrReviewNotExist(err)) @@ -105,3 +105,33 @@ func TestUpdateReview(t *testing.T) { assert.NoError(t, UpdateReview(review)) AssertExistsAndLoadBean(t, &Review{ID: 1, Content: "Updated Review"}) } + +func TestGetReviewersByPullID(t *testing.T) { + assert.NoError(t, PrepareTestDatabase()) + + issue := AssertExistsAndLoadBean(t, &Issue{ID: 3}).(*Issue) + user2 := AssertExistsAndLoadBean(t, &User{ID: 2}).(*User) + user3 := AssertExistsAndLoadBean(t, &User{ID: 3}).(*User) + user4 := AssertExistsAndLoadBean(t, &User{ID: 4}).(*User) + + expectedReviews := []*PullReviewersWithType{} + expectedReviews = append(expectedReviews, &PullReviewersWithType{ + User: *user2, + Type: ReviewTypeReject, + ReviewUpdatedUnix: 946684810, + }, + &PullReviewersWithType{ + User: *user3, + Type: ReviewTypeReject, + ReviewUpdatedUnix: 946684810, + }, + &PullReviewersWithType{ + User: *user4, + Type: ReviewTypeApprove, + ReviewUpdatedUnix: 946684810, + }) + + allReviews, err := GetReviewersByPullID(issue.ID) + assert.NoError(t, err) + assert.Equal(t, expectedReviews, allReviews) +} |