You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pull_test.go 647B

1234567891011121314151617181920212223
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package convert
  5. import (
  6. "testing"
  7. "code.gitea.io/gitea/models"
  8. "github.com/stretchr/testify/assert"
  9. )
  10. func TestPullRequest_APIFormat(t *testing.T) {
  11. assert.NoError(t, models.PrepareTestDatabase())
  12. pr := models.AssertExistsAndLoadBean(t, &models.PullRequest{ID: 1}).(*models.PullRequest)
  13. assert.NoError(t, pr.LoadAttributes())
  14. assert.NoError(t, pr.LoadIssue())
  15. apiPullRequest := ToAPIPullRequest(pr)
  16. assert.NotNil(t, apiPullRequest)
  17. assert.Nil(t, apiPullRequest.Head)
  18. }