aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/pull_status_test.go
diff options
context:
space:
mode:
authorMura Li <typeless@users.noreply.github.com>2019-08-21 01:43:00 +0800
committertechknowlogick <techknowlogick@gitea.io>2019-08-20 13:43:00 -0400
commit3ac45e3cb58c81941618be69d40a0e2ea39080bf (patch)
tree1bbff0d3cd0cde399ddba8625d03711e96535f1d /integrations/pull_status_test.go
parent31f5713a1f2f6267a66526eacf502e3cce73f737 (diff)
downloadgitea-3ac45e3cb58c81941618be69d40a0e2ea39080bf.tar.gz
gitea-3ac45e3cb58c81941618be69d40a0e2ea39080bf.zip
Fix pull creation with empty changes (#7920)
* Logs the stderr of git-apply * Add an integration test * Skip testPatch when patch is empty
Diffstat (limited to 'integrations/pull_status_test.go')
-rw-r--r--integrations/pull_status_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go
index 2a4d8e0b68..fde2d3cc9b 100644
--- a/integrations/pull_status_test.go
+++ b/integrations/pull_status_test.go
@@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"path"
+ "strings"
"testing"
"code.gitea.io/gitea/models"
@@ -93,3 +94,28 @@ func TestPullCreate_CommitStatus(t *testing.T) {
}
})
}
+
+func TestPullCreate_EmptyChangesWithCommits(t *testing.T) {
+ onGiteaRun(t, func(t *testing.T, u *url.URL) {
+ session := loginUser(t, "user1")
+ testRepoFork(t, session, "user2", "repo1", "user1", "repo1")
+ testEditFileToNewBranch(t, session, "user1", "repo1", "master", "status1", "README.md", "status1")
+ testEditFileToNewBranch(t, session, "user1", "repo1", "status1", "status1", "README.md", "# repo1\n\nDescription for repo1")
+
+ url := path.Join("user1", "repo1", "compare", "master...status1")
+ req := NewRequestWithValues(t, "POST", url,
+ map[string]string{
+ "_csrf": GetCSRF(t, session, url),
+ "title": "pull request from status1",
+ },
+ )
+ session.MakeRequest(t, req, http.StatusFound)
+
+ req = NewRequest(t, "GET", "/user1/repo1/pulls/1")
+ resp := session.MakeRequest(t, req, http.StatusOK)
+ doc := NewHTMLParser(t, resp.Body)
+
+ text := strings.TrimSpace(doc.doc.Find(".item.text.green").Text())
+ assert.EqualValues(t, "This pull request can be merged automatically.", text)
+ })
+}