diff options
author | Ethan Koenig <etk39@cornell.edu> | 2017-07-07 15:36:47 -0400 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2017-07-07 21:36:47 +0200 |
commit | f1adaef45849fc260b07be39a39b9c1ee5146923 (patch) | |
tree | bc33151ef4021ae14adf2e6cfc694b9e4729cef8 /integrations/repo_fork_test.go | |
parent | 5651cc7413640f12a9eb8dee64d332ea9597afce (diff) | |
download | gitea-f1adaef45849fc260b07be39a39b9c1ee5146923.tar.gz gitea-f1adaef45849fc260b07be39a39b9c1ee5146923.zip |
Less verbose integration tests (#2123)
* Helper functions for intergration test boilerplate
Diffstat (limited to 'integrations/repo_fork_test.go')
-rw-r--r-- | integrations/repo_fork_test.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/integrations/repo_fork_test.go b/integrations/repo_fork_test.go index ccb7a4c19e..bd6ec79155 100644 --- a/integrations/repo_fork_test.go +++ b/integrations/repo_fork_test.go @@ -14,21 +14,18 @@ import ( func testRepoFork(t *testing.T, session *TestSession) *TestResponse { // Step0: check the existence of the to-fork repo req := NewRequest(t, "GET", "/user1/repo1") - resp := session.MakeRequest(t, req) - assert.EqualValues(t, http.StatusNotFound, resp.HeaderCode) + resp := session.MakeRequest(t, req, http.StatusNotFound) // Step1: go to the main page of repo req = NewRequest(t, "GET", "/user2/repo1") - resp = session.MakeRequest(t, req) - assert.EqualValues(t, http.StatusOK, resp.HeaderCode) + resp = session.MakeRequest(t, req, http.StatusOK) // Step2: click the fork button htmlDoc := NewHTMLParser(t, resp.Body) link, exists := htmlDoc.doc.Find("a.ui.button[href^=\"/repo/fork/\"]").Attr("href") assert.True(t, exists, "The template has changed") req = NewRequest(t, "GET", link) - resp = session.MakeRequest(t, req) - assert.EqualValues(t, http.StatusOK, resp.HeaderCode) + resp = session.MakeRequest(t, req, http.StatusOK) // Step3: fill the form of the forking htmlDoc = NewHTMLParser(t, resp.Body) @@ -39,13 +36,11 @@ func testRepoFork(t *testing.T, session *TestSession) *TestResponse { "uid": "1", "repo_name": "repo1", }) - resp = session.MakeRequest(t, req) - assert.EqualValues(t, http.StatusFound, resp.HeaderCode) + resp = session.MakeRequest(t, req, http.StatusFound) // Step4: check the existence of the forked repo req = NewRequest(t, "GET", "/user1/repo1") - resp = session.MakeRequest(t, req) - assert.EqualValues(t, http.StatusOK, resp.HeaderCode) + resp = session.MakeRequest(t, req, http.StatusOK) return resp } |