1
0
Fork 0
forked from forgejo/forgejo

Convert to url auth to header auth in tests (#28484)

Related #28390
This commit is contained in:
KN4CK3R 2023-12-22 00:59:59 +01:00 committed by GitHub
parent 04b235d094
commit 838db2f891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
102 changed files with 1715 additions and 1523 deletions

View file

@ -182,13 +182,13 @@ func TestAPINewWikiPage(t *testing.T) {
session := loginUser(t, username)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/new?token=%s", username, "repo1", token)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/new", username, "repo1")
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateWikiPageOptions{
Title: title,
ContentBase64: base64.StdEncoding.EncodeToString([]byte("Wiki page content for API unit tests")),
Message: "",
})
}).AddTokenAuth(token)
MakeRequest(t, req, http.StatusCreated)
}
}
@ -199,13 +199,13 @@ func TestAPIEditWikiPage(t *testing.T) {
session := loginUser(t, username)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteRepository)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/page/Page-With-Spaced-Name?token=%s", username, "repo1", token)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/page/Page-With-Spaced-Name", username, "repo1")
req := NewRequestWithJSON(t, "PATCH", urlStr, &api.CreateWikiPageOptions{
Title: "edited title",
ContentBase64: base64.StdEncoding.EncodeToString([]byte("Edited wiki page content for API unit tests")),
Message: "",
})
}).AddTokenAuth(token)
MakeRequest(t, req, http.StatusOK)
}