1
0
Fork 0
forked from forgejo/forgejo

Don't delete branch if other PRs with this branch are open (#18164)

fix #18149

Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
a1012112796 2022-01-04 03:45:58 +08:00 committed by GitHub
parent 650a50a7ba
commit 637c3ec5d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 1 deletions

View file

@ -107,6 +107,18 @@ func TestGetUnmergedPullRequest(t *testing.T) {
assert.True(t, IsErrPullRequestNotExist(err))
}
func TestHasUnmergedPullRequestsByHeadInfo(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
exist, err := HasUnmergedPullRequestsByHeadInfo(1, "branch2")
assert.NoError(t, err)
assert.Equal(t, true, exist)
exist, err = HasUnmergedPullRequestsByHeadInfo(1, "not_exist_branch")
assert.NoError(t, err)
assert.Equal(t, false, exist)
}
func TestGetUnmergedPullRequestsByHeadInfo(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
prs, err := GetUnmergedPullRequestsByHeadInfo(1, "branch2")