Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 01:44:24 +01:00

[GITEA] Optionally allow anyone to edit Wikis (squash) AddTokenAuth

This commit is contained in:
Earl Warren 2024-01-15 16:55:10 +00:00
parent 1296f4d115
commit fed50cf72e
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -234,12 +234,12 @@ func TestAPIEditOtherWikiPage(t *testing.T) {
// Creating a new Wiki page on user2's repo as user1 fails // Creating a new Wiki page on user2's repo as user1 fails
testCreateWiki := func(expectedStatusCode int) { testCreateWiki := func(expectedStatusCode int) {
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/new?token=%s", otherUsername, "repo1", token) urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/wiki/new", otherUsername, "repo1")
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateWikiPageOptions{ req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateWikiPageOptions{
Title: "Globally Edited Page", Title: "Globally Edited Page",
ContentBase64: base64.StdEncoding.EncodeToString([]byte("Wiki page content for API unit tests")), ContentBase64: base64.StdEncoding.EncodeToString([]byte("Wiki page content for API unit tests")),
Message: "", Message: "",
}) }).AddTokenAuth(token)
session.MakeRequest(t, req, expectedStatusCode) session.MakeRequest(t, req, expectedStatusCode)
} }
testCreateWiki(http.StatusForbidden) testCreateWiki(http.StatusForbidden)