summaryrefslogtreecommitdiffstats
path: root/integrations/editor_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/editor_test.go')
-rw-r--r--integrations/editor_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/integrations/editor_test.go b/integrations/editor_test.go
index 712cc91fbc..0722a917f0 100644
--- a/integrations/editor_test.go
+++ b/integrations/editor_test.go
@@ -6,6 +6,7 @@ package integrations
import (
"net/http"
+ "net/http/httptest"
"path"
"testing"
@@ -72,7 +73,7 @@ func TestCreateFileOnProtectedBranch(t *testing.T) {
resp = session.MakeRequest(t, req, http.StatusOK)
// Check body for error message
- assert.Contains(t, string(resp.Body), "Can not commit to protected branch 'master'.")
+ assert.Contains(t, resp.Body.String(), "Can not commit to protected branch 'master'.")
// remove the protected branch
csrf = GetCSRF(t, session, "/user2/repo1/settings/branches")
@@ -89,7 +90,7 @@ func TestCreateFileOnProtectedBranch(t *testing.T) {
}
-func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePath, newContent string) *TestResponse {
+func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePath, newContent string) *httptest.ResponseRecorder {
// Get to the 'edit this file' page
req := NewRequest(t, "GET", path.Join(user, repo, "_edit", branch, filePath))
resp := session.MakeRequest(t, req, http.StatusOK)
@@ -113,12 +114,12 @@ func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePa
// Verify the change
req = NewRequest(t, "GET", path.Join(user, repo, "raw/branch", branch, filePath))
resp = session.MakeRequest(t, req, http.StatusOK)
- assert.EqualValues(t, newContent, string(resp.Body))
+ assert.EqualValues(t, newContent, resp.Body.String())
return resp
}
-func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, branch, targetBranch, filePath, newContent string) *TestResponse {
+func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, branch, targetBranch, filePath, newContent string) *httptest.ResponseRecorder {
// Get to the 'edit this file' page
req := NewRequest(t, "GET", path.Join(user, repo, "_edit", branch, filePath))
@@ -144,7 +145,7 @@ func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, bra
// Verify the change
req = NewRequest(t, "GET", path.Join(user, repo, "raw/branch", targetBranch, filePath))
resp = session.MakeRequest(t, req, http.StatusOK)
- assert.EqualValues(t, newContent, string(resp.Body))
+ assert.EqualValues(t, newContent, resp.Body.String())
return resp
}