aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/branches_test.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-12-03 14:46:01 -0800
committerLauris BH <lauris@nix.lv>2017-12-04 00:46:01 +0200
commite59adcde655aac0e8afd3249407c9a0a2b1b1d6b (patch)
treea1b5859eadfe6ffdfc106012b7eab13a16459813 /integrations/branches_test.go
parent993b86628bdf62c0565c2a57a73561bb2d535b22 (diff)
downloadgitea-e59adcde655aac0e8afd3249407c9a0a2b1b1d6b.tar.gz
gitea-e59adcde655aac0e8afd3249407c9a0a2b1b1d6b.zip
Use httptest in integration tests (#3080)
Diffstat (limited to 'integrations/branches_test.go')
-rw-r--r--integrations/branches_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/integrations/branches_test.go b/integrations/branches_test.go
index 7fb57242d9..01c6dd2a4b 100644
--- a/integrations/branches_test.go
+++ b/integrations/branches_test.go
@@ -59,9 +59,8 @@ func branchAction(t *testing.T, button string) (*HTMLDoc, string) {
link, exists := htmlDoc.doc.Find(button).Attr("data-url")
assert.True(t, exists, "The template has changed")
- htmlDoc = NewHTMLParser(t, resp.Body)
req = NewRequestWithValues(t, "POST", link, map[string]string{
- "_csrf": getCsrf(htmlDoc.doc),
+ "_csrf": getCsrf(t, htmlDoc.doc),
})
resp = session.MakeRequest(t, req, http.StatusOK)
@@ -73,7 +72,8 @@ func branchAction(t *testing.T, button string) (*HTMLDoc, string) {
return NewHTMLParser(t, resp.Body), url.Query()["name"][0]
}
-func getCsrf(doc *goquery.Document) string {
- csrf, _ := doc.Find("meta[name=\"_csrf\"]").Attr("content")
+func getCsrf(t *testing.T, doc *goquery.Document) string {
+ csrf, exists := doc.Find("meta[name=\"_csrf\"]").Attr("content")
+ assert.True(t, exists)
return csrf
}