diff options
author | quantonganh <quanta.linux@gmail.com> | 2019-07-08 14:32:46 +0700 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-07-08 10:32:46 +0300 |
commit | ff85a6331e02338100e3799b5787bf8b686fe003 (patch) | |
tree | 5dcbfd379660e9c5f2c9632d862dfbe1a2a92799 /models/pull_test.go | |
parent | cb2ec41dce97c9ceb8db97332d1fa600bace3af5 (diff) | |
download | gitea-ff85a6331e02338100e3799b5787bf8b686fe003.tar.gz gitea-ff85a6331e02338100e3799b5787bf8b686fe003.zip |
only return head: null if source branch was deleted (#6705)
* only return head: null if source branch was deleted
* add URL into GetPullRequest
* TestPullRequest_APIFormat
* log error if it is not Err(Branch)NotExist
Diffstat (limited to 'models/pull_test.go')
-rw-r--r-- | models/pull_test.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/models/pull_test.go b/models/pull_test.go index 5a53474ac4..df051d51bc 100644 --- a/models/pull_test.go +++ b/models/pull_test.go @@ -31,7 +31,15 @@ func TestPullRequest_LoadIssue(t *testing.T) { assert.Equal(t, int64(2), pr.Issue.ID) } -// TODO TestPullRequest_APIFormat +func TestPullRequest_APIFormat(t *testing.T) { + assert.NoError(t, PrepareTestDatabase()) + pr := AssertExistsAndLoadBean(t, &PullRequest{ID: 1}).(*PullRequest) + assert.NoError(t, pr.LoadAttributes()) + assert.NoError(t, pr.LoadIssue()) + apiPullRequest := pr.APIFormat() + assert.NotNil(t, apiPullRequest) + assert.Nil(t, apiPullRequest.Head) +} func TestPullRequest_GetBaseRepo(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) |