diff options
Diffstat (limited to 'integrations/pull_merge_test.go')
-rw-r--r-- | integrations/pull_merge_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go index 27f3586406..b375a55f53 100644 --- a/integrations/pull_merge_test.go +++ b/integrations/pull_merge_test.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/test" + "github.com/Unknwon/i18n" "github.com/stretchr/testify/assert" ) @@ -123,3 +124,23 @@ func TestPullCleanUpAfterMerge(t *testing.T) { assert.EqualValues(t, "Branch 'user1/feature/test' has been deleted.", resultMsg) } + +func TestCantMergeWorkInProgress(t *testing.T) { + prepareTestEnv(t) + session := loginUser(t, "user1") + testRepoFork(t, session, "user2", "repo1", "user1", "repo1") + testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n") + + resp := testPullCreate(t, session, "user1", "repo1", "master", "[wip] This is a pull title") + + req := NewRequest(t, "GET", resp.Header().Get("Location")) + resp = session.MakeRequest(t, req, http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + text := strings.TrimSpace(htmlDoc.doc.Find(".merge.segment > .text.grey").Text()) + assert.NotEmpty(t, text, "Can't find WIP text") + + // remove <strong /> from lang + expected := i18n.Tr("en", "repo.pulls.cannot_merge_work_in_progress", "[wip]") + replacer := strings.NewReplacer("<strong>", "", "</strong>", "") + assert.Equal(t, replacer.Replace(expected), text, "Unable to find WIP text") +} |