test: use the add token auth method for token

This commit is contained in:
dineshsalunke
2024-01-17 23:20:02 +05:30
parent 5f4e945540
commit eeae27100e

View File

@@ -89,9 +89,7 @@ func TestAPIListUserProjects(t *testing.T) {
token := getUserToken(t, "user2", auth_model.AccessTokenScopeReadUser, auth_model.AccessTokenScopeReadIssue) token := getUserToken(t, "user2", auth_model.AccessTokenScopeReadUser, auth_model.AccessTokenScopeReadIssue)
link, _ := url.Parse(fmt.Sprintf("/api/v1/user/projects")) link, _ := url.Parse(fmt.Sprintf("/api/v1/user/projects"))
link.RawQuery = url.Values{"token": {token}}.Encode() req := NewRequest(t, "GET", link.String()).AddTokenAuth(token)
req := NewRequest(t, "GET", link.String())
var apiProjects []*api.Project var apiProjects []*api.Project
resp := MakeRequest(t, req, http.StatusOK) resp := MakeRequest(t, req, http.StatusOK)