aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/editor_test.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-10-16 00:54:53 +0300
committerGitHub <noreply@github.com>2017-10-16 00:54:53 +0300
commitc7f4f07765a96ac4b66f40167ed4207aa4e34dad (patch)
treee476f019eb40cd61de15398ef3c928606b5dda5d /integrations/editor_test.go
parentf3833b7ce4dc78095194808c6e07d8ae133e7ab5 (diff)
downloadgitea-c7f4f07765a96ac4b66f40167ed4207aa4e34dad.tar.gz
gitea-c7f4f07765a96ac4b66f40167ed4207aa4e34dad.zip
Integration test for activity page (#2704)
* Integration test for activity page * Small code refactoring for acitvity page * Move activity stats calculation logic to model
Diffstat (limited to 'integrations/editor_test.go')
-rw-r--r--integrations/editor_test.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/integrations/editor_test.go b/integrations/editor_test.go
index cc94edfd3f..453b38491d 100644
--- a/integrations/editor_test.go
+++ b/integrations/editor_test.go
@@ -89,10 +89,7 @@ func TestCreateFileOnProtectedBranch(t *testing.T) {
}
-func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePath string) *TestResponse {
-
- newContent := "Hello, World (Edited)\n"
-
+func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePath, newContent string) *TestResponse {
// 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)
@@ -121,9 +118,7 @@ func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePa
return resp
}
-func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, branch, targetBranch, filePath string) *TestResponse {
-
- newContent := "Hello, World (Edited)\n"
+func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, branch, targetBranch, filePath, newContent string) *TestResponse {
// Get to the 'edit this file' page
req := NewRequest(t, "GET", path.Join(user, repo, "_edit", branch, filePath))
@@ -157,11 +152,11 @@ func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, bra
func TestEditFile(t *testing.T) {
prepareTestEnv(t)
session := loginUser(t, "user2")
- testEditFile(t, session, "user2", "repo1", "master", "README.md")
+ testEditFile(t, session, "user2", "repo1", "master", "README.md", "Hello, World (Edited)\n")
}
func TestEditFileToNewBranch(t *testing.T) {
prepareTestEnv(t)
session := loginUser(t, "user2")
- testEditFileToNewBranch(t, session, "user2", "repo1", "master", "feature/test", "README.md")
+ testEditFileToNewBranch(t, session, "user2", "repo1", "master", "feature/test", "README.md", "Hello, World (Edited)\n")
}