diff options
author | Ethan Koenig <ethantkoenig@gmail.com> | 2017-12-03 14:46:01 -0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2017-12-04 00:46:01 +0200 |
commit | e59adcde655aac0e8afd3249407c9a0a2b1b1d6b (patch) | |
tree | a1b5859eadfe6ffdfc106012b7eab13a16459813 /integrations/branches_test.go | |
parent | 993b86628bdf62c0565c2a57a73561bb2d535b22 (diff) | |
download | gitea-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.go | 8 |
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 } |