1
0
Fork 0
forked from forgejo/forgejo

Improve integration test helper functions (#2049)

Set request headers in helper functions, and new helper for requests with string-formatted URLs
This commit is contained in:
Ethan Koenig 2017-06-24 20:15:42 -04:00 committed by Lunny Xiao
parent 3ffedeab03
commit f64c232953
13 changed files with 9 additions and 24 deletions

View file

@ -5,7 +5,6 @@
package integrations
import (
"fmt"
"net/http"
"testing"
@ -22,8 +21,7 @@ func TestAPITeam(t *testing.T) {
user := models.AssertExistsAndLoadBean(t, &models.User{ID: teamUser.UID}).(*models.User)
session := loginUser(t, user.Name)
url := fmt.Sprintf("/api/v1/teams/%d", teamUser.TeamID)
req := NewRequest(t, "GET", url)
req := NewRequestf(t, "GET", "/api/v1/teams/%d", teamUser.TeamID)
resp := session.MakeRequest(t, req)
assert.EqualValues(t, http.StatusOK, resp.HeaderCode)