mirror of
1
Fork 0

[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
1 changed files with 2 additions and 2 deletions

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)