diff options
author | 6543 <6543@obermui.de> | 2022-03-31 16:53:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 16:53:08 +0200 |
commit | 9c349a4277926bfd3ff0360301765ad7abd9f10b (patch) | |
tree | 6a3859850e61aca261738438deaf6075b1d30612 /models/pull_test.go | |
parent | f6145a69c4814d9aaaeac5d73c743b2f65bc586c (diff) | |
download | gitea-9c349a4277926bfd3ff0360301765ad7abd9f10b.tar.gz gitea-9c349a4277926bfd3ff0360301765ad7abd9f10b.zip |
Move checks for pulls before merge into own function (#19271)
This make checks in one single place so they dont differ and maintainer can not forget a check in one place while adding it to the other .... ( as it's atm )
Fix:
* The API does ignore issue dependencies where Web does not
* The API checks if "IsSignedIfRequired" where Web does not - UI probably do but nothing will some to craft custom requests
* Default merge message is crafted a bit different between API and Web if not set on specific cases ...
Diffstat (limited to 'models/pull_test.go')
-rw-r--r-- | models/pull_test.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/models/pull_test.go b/models/pull_test.go index 2567984cc1..9098b61161 100644 --- a/models/pull_test.go +++ b/models/pull_test.go @@ -261,11 +261,15 @@ func TestPullRequest_GetDefaultMergeMessage_InternalTracker(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) pr := unittest.AssertExistsAndLoadBean(t, &PullRequest{ID: 2}).(*PullRequest) - assert.Equal(t, "Merge pull request 'issue3' (#3) from branch2 into master", pr.GetDefaultMergeMessage()) + msg, err := pr.GetDefaultMergeMessage() + assert.NoError(t, err) + assert.Equal(t, "Merge pull request 'issue3' (#3) from branch2 into master", msg) pr.BaseRepoID = 1 pr.HeadRepoID = 2 - assert.Equal(t, "Merge pull request 'issue3' (#3) from user2/repo1:branch2 into master", pr.GetDefaultMergeMessage()) + msg, err = pr.GetDefaultMergeMessage() + assert.NoError(t, err) + assert.Equal(t, "Merge pull request 'issue3' (#3) from user2/repo1:branch2 into master", msg) } func TestPullRequest_GetDefaultMergeMessage_ExternalTracker(t *testing.T) { @@ -283,9 +287,13 @@ func TestPullRequest_GetDefaultMergeMessage_ExternalTracker(t *testing.T) { pr := unittest.AssertExistsAndLoadBean(t, &PullRequest{ID: 2, BaseRepo: baseRepo}).(*PullRequest) - assert.Equal(t, "Merge pull request 'issue3' (!3) from branch2 into master", pr.GetDefaultMergeMessage()) + msg, err := pr.GetDefaultMergeMessage() + assert.NoError(t, err) + assert.Equal(t, "Merge pull request 'issue3' (!3) from branch2 into master", msg) pr.BaseRepoID = 1 pr.HeadRepoID = 2 - assert.Equal(t, "Merge pull request 'issue3' (!3) from user2/repo1:branch2 into master", pr.GetDefaultMergeMessage()) + msg, err = pr.GetDefaultMergeMessage() + assert.NoError(t, err) + assert.Equal(t, "Merge pull request 'issue3' (!3) from user2/repo1:branch2 into master", msg) } |