mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-22 07:18:31 -04:00
Remove session in api tests (#21984)
It's no meaning to request an API route with session.
This commit is contained in:
parent
665d02efaf
commit
df676a47d0
46 changed files with 387 additions and 433 deletions
|
@ -27,7 +27,7 @@ func TestAPIListStopWatches(t *testing.T) {
|
|||
session := loginUser(t, owner.Name)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
req := NewRequestf(t, "GET", "/api/v1/user/stopwatches?token=%s", token)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
var apiWatches []*api.StopWatch
|
||||
DecodeJSON(t, resp, &apiWatches)
|
||||
stopwatch := unittest.AssertExistsAndLoadBean(t, &issues_model.Stopwatch{UserID: owner.ID})
|
||||
|
@ -54,8 +54,8 @@ func TestAPIStopStopWatches(t *testing.T) {
|
|||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
req := NewRequestf(t, "POST", "/api/v1/repos/%s/%s/issues/%d/stopwatch/stop?token=%s", owner.Name, issue.Repo.Name, issue.Index, token)
|
||||
session.MakeRequest(t, req, http.StatusCreated)
|
||||
session.MakeRequest(t, req, http.StatusConflict)
|
||||
MakeRequest(t, req, http.StatusCreated)
|
||||
MakeRequest(t, req, http.StatusConflict)
|
||||
}
|
||||
|
||||
func TestAPICancelStopWatches(t *testing.T) {
|
||||
|
@ -70,8 +70,8 @@ func TestAPICancelStopWatches(t *testing.T) {
|
|||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
req := NewRequestf(t, "DELETE", "/api/v1/repos/%s/%s/issues/%d/stopwatch/delete?token=%s", owner.Name, issue.Repo.Name, issue.Index, token)
|
||||
session.MakeRequest(t, req, http.StatusNoContent)
|
||||
session.MakeRequest(t, req, http.StatusConflict)
|
||||
MakeRequest(t, req, http.StatusNoContent)
|
||||
MakeRequest(t, req, http.StatusConflict)
|
||||
}
|
||||
|
||||
func TestAPIStartStopWatches(t *testing.T) {
|
||||
|
@ -86,6 +86,6 @@ func TestAPIStartStopWatches(t *testing.T) {
|
|||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
req := NewRequestf(t, "POST", "/api/v1/repos/%s/%s/issues/%d/stopwatch/start?token=%s", owner.Name, issue.Repo.Name, issue.Index, token)
|
||||
session.MakeRequest(t, req, http.StatusCreated)
|
||||
session.MakeRequest(t, req, http.StatusConflict)
|
||||
MakeRequest(t, req, http.StatusCreated)
|
||||
MakeRequest(t, req, http.StatusConflict)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue