loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'test(oauth): coverage for the redirection of a denied grant' (#4026) from earl-warren/forgejo:wip-oauth into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4026
Reviewed-by: oliverpool <oliverpool@noreply.codeberg.org>

+22
+1
release-notes/8.0.0/fix/4026.md
··· 1 + - when an OAuth grant request submitted to a Forgejo user is denied, the server from which the request originates is not notified that it has been denied
+21
tests/integration/oauth_test.go
··· 608 608 resp := MakeRequest(t, req, http.StatusSeeOther) 609 609 assert.Equal(t, test.RedirectURL(resp), "/user/link_account") 610 610 } 611 + 612 + func TestOAuth_GrantApplicationOAuth(t *testing.T) { 613 + defer tests.PrepareTestEnv(t)() 614 + 615 + req := NewRequest(t, "GET", "/login/oauth/authorize?client_id=da7da3ba-9a13-4167-856f-3899de0b0138&redirect_uri=a&response_type=code&state=thestate") 616 + ctx := loginUser(t, "user4") 617 + resp := ctx.MakeRequest(t, req, http.StatusOK) 618 + 619 + htmlDoc := NewHTMLParser(t, resp.Body) 620 + htmlDoc.AssertElement(t, "#authorize-app", true) 621 + 622 + req = NewRequestWithValues(t, "POST", "/login/oauth/grant", map[string]string{ 623 + "_csrf": htmlDoc.GetCSRF(), 624 + "client_id": "da7da3ba-9a13-4167-856f-3899de0b0138", 625 + "redirect_uri": "a", 626 + "state": "thestate", 627 + "granted": "false", 628 + }) 629 + resp = ctx.MakeRequest(t, req, http.StatusSeeOther) 630 + assert.Contains(t, test.RedirectURL(resp), "error=access_denied&error_description=the+request+is+denied") 631 + }