summaryrefslogtreecommitdiffstats
path: root/modules/convert/pull_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/convert/pull_test.go')
-rw-r--r--modules/convert/pull_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/convert/pull_test.go b/modules/convert/pull_test.go
index fe82a61bd4..b78bbe87c9 100644
--- a/modules/convert/pull_test.go
+++ b/modules/convert/pull_test.go
@@ -8,6 +8,7 @@ import (
"testing"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/structs"
"github.com/stretchr/testify/assert"
)
@@ -15,12 +16,19 @@ import (
func TestPullRequest_APIFormat(t *testing.T) {
//with HeadRepo
assert.NoError(t, models.PrepareTestDatabase())
+ headRepo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
pr := models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
assert.NoError(t, pr.LoadAttributes())
assert.NoError(t, pr.LoadIssue())
apiPullRequest := ToAPIPullRequest(pr)
assert.NotNil(t, apiPullRequest)
- assert.Nil(t, apiPullRequest.Head)
+ assert.EqualValues(t, &structs.PRBranchInfo{
+ Name: "branch1",
+ Ref: "refs/pull/2/head",
+ Sha: "4a357436d925b5c974181ff12a994538ddc5a269",
+ RepoID: 1,
+ Repository: headRepo.APIFormat(models.AccessModeNone),
+ }, apiPullRequest.Head)
//withOut HeadRepo
pr = models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)