summaryrefslogtreecommitdiffstats
path: root/integrations/pull_merge_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/pull_merge_test.go')
-rw-r--r--integrations/pull_merge_test.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go
index 9249f39bd6..ddb18f8024 100644
--- a/integrations/pull_merge_test.go
+++ b/integrations/pull_merge_test.go
@@ -15,36 +15,32 @@ import (
func testPullMerge(t *testing.T, session *TestSession, user, repo, pullnum string) *TestResponse {
req := NewRequest(t, "GET", path.Join(user, repo, "pulls", pullnum))
- resp := session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
+ resp := session.MakeRequest(t, req, http.StatusOK)
- // Click the little green button to craete a pull
+ // Click the little green button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body)
link, exists := htmlDoc.doc.Find("form.ui.form>button.ui.green.button").Parent().Attr("action")
assert.True(t, exists, "The template has changed")
req = NewRequestWithValues(t, "POST", link, map[string]string{
"_csrf": htmlDoc.GetCSRF(),
})
- resp = session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusFound, resp.HeaderCode)
+ resp = session.MakeRequest(t, req, http.StatusFound)
return resp
}
func testPullCleanUp(t *testing.T, session *TestSession, user, repo, pullnum string) *TestResponse {
req := NewRequest(t, "GET", path.Join(user, repo, "pulls", pullnum))
- resp := session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
+ resp := session.MakeRequest(t, req, http.StatusOK)
- // Click the little green button to craete a pull
+ // Click the little green button to create a pull
htmlDoc := NewHTMLParser(t, resp.Body)
link, exists := htmlDoc.doc.Find(".comments .merge .delete-button").Attr("data-url")
assert.True(t, exists, "The template has changed")
req = NewRequestWithValues(t, "POST", link, map[string]string{
"_csrf": htmlDoc.GetCSRF(),
})
- resp = session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
+ resp = session.MakeRequest(t, req, http.StatusOK)
return resp
}
@@ -56,10 +52,8 @@ func TestPullMerge(t *testing.T) {
testEditFile(t, session, "user1", "repo1", "master", "README.md")
resp := testPullCreate(t, session, "user1", "repo1", "master")
- redirectedURL := resp.Headers["Location"]
- assert.NotEmpty(t, redirectedURL, "Redirected URL is not found")
- elem := strings.Split(redirectedURL[0], "/")
+ elem := strings.Split(RedirectURL(t, resp), "/")
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4])
}
@@ -71,10 +65,8 @@ func TestPullCleanUpAfterMerge(t *testing.T) {
testEditFileToNewBranch(t, session, "user1", "repo1", "master", "feature/test", "README.md")
resp := testPullCreate(t, session, "user1", "repo1", "feature/test")
- redirectedURL := resp.Headers["Location"]
- assert.NotEmpty(t, redirectedURL, "Redirected URL is not found")
- elem := strings.Split(redirectedURL[0], "/")
+ elem := strings.Split(RedirectURL(t, resp), "/")
assert.EqualValues(t, "pulls", elem[3])
testPullMerge(t, session, elem[1], elem[2], elem[4])
@@ -92,8 +84,7 @@ func TestPullCleanUpAfterMerge(t *testing.T) {
// Check branch deletion result
req := NewRequest(t, "GET", respJSON.Redirect)
- resp = session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
+ resp = session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
resultMsg := htmlDoc.doc.Find(".ui.message>p").Text()