diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-03-03 06:31:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 22:31:55 +0000 |
commit | 5abe1c52de533b52725b1e584db9fea6fb1b39ab (patch) | |
tree | 1cd49bc1a609bb919c70d6bc30727c524c3e6105 /models/pull_test.go | |
parent | 22b750702408a39a524e011b729d0e0befb30e16 (diff) | |
download | gitea-5abe1c52de533b52725b1e584db9fea6fb1b39ab.tar.gz gitea-5abe1c52de533b52725b1e584db9fea6fb1b39ab.zip |
Display pull request head branch even the branch deleted or repository deleted (#10413)
* Display pull request head branch even the branch deleted or repository deleted
* Merge getHeadRepo/loadHeadRepo and getBaseRepo/loadBaseRepo on pull and fill repo when pr.Issue.Repo is available
* retrieve sha from pull head when pull request branch deleted and fix tests
* Fix test
* Ensure MustHeadRepoName returns empty string if no head repo
Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/pull_test.go')
-rw-r--r-- | models/pull_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/models/pull_test.go b/models/pull_test.go index 0dc3bb86d7..3cc6abfec7 100644 --- a/models/pull_test.go +++ b/models/pull_test.go @@ -29,21 +29,21 @@ func TestPullRequest_LoadIssue(t *testing.T) { assert.Equal(t, int64(2), pr.Issue.ID) } -func TestPullRequest_GetBaseRepo(t *testing.T) { +func TestPullRequest_LoadBaseRepo(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) pr := AssertExistsAndLoadBean(t, &PullRequest{ID: 1}).(*PullRequest) - assert.NoError(t, pr.GetBaseRepo()) + assert.NoError(t, pr.LoadBaseRepo()) assert.NotNil(t, pr.BaseRepo) assert.Equal(t, pr.BaseRepoID, pr.BaseRepo.ID) - assert.NoError(t, pr.GetBaseRepo()) + assert.NoError(t, pr.LoadBaseRepo()) assert.NotNil(t, pr.BaseRepo) assert.Equal(t, pr.BaseRepoID, pr.BaseRepo.ID) } -func TestPullRequest_GetHeadRepo(t *testing.T) { +func TestPullRequest_LoadHeadRepo(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) pr := AssertExistsAndLoadBean(t, &PullRequest{ID: 1}).(*PullRequest) - assert.NoError(t, pr.GetHeadRepo()) + assert.NoError(t, pr.LoadHeadRepo()) assert.NotNil(t, pr.HeadRepo) assert.Equal(t, pr.HeadRepoID, pr.HeadRepo.ID) } |