This commit is contained in:
@@ -5,11 +5,13 @@ package integration
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/container"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/tests"
|
||||
"gitea.dev/modules/container"
|
||||
"gitea.dev/modules/setting"
|
||||
"gitea.dev/modules/test"
|
||||
"gitea.dev/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -68,7 +70,7 @@ func TestUserSettingsAccount(t *testing.T) {
|
||||
|
||||
AssertHTMLElement(t, doc, "#password", true)
|
||||
AssertHTMLElement(t, doc, "#email", true)
|
||||
AssertHTMLElement(t, doc, "#delete-form", true)
|
||||
AssertHTMLElement(t, doc, `form[action="/user/settings/account/delete"]`, true)
|
||||
})
|
||||
|
||||
t.Run("credentials disabled", func(t *testing.T) {
|
||||
@@ -85,7 +87,7 @@ func TestUserSettingsAccount(t *testing.T) {
|
||||
|
||||
AssertHTMLElement(t, doc, "#password", false)
|
||||
AssertHTMLElement(t, doc, "#email", false)
|
||||
AssertHTMLElement(t, doc, "#delete-form", true)
|
||||
AssertHTMLElement(t, doc, `form[action="/user/settings/account/delete"]`, true)
|
||||
})
|
||||
|
||||
t.Run("deletion disabled", func(t *testing.T) {
|
||||
@@ -309,20 +311,26 @@ func TestUserSettingsApplications(t *testing.T) {
|
||||
})
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
msg := doc.Find(".flash-error p").Text()
|
||||
assert.Equal(t, `form.RedirectURIs"ftp://127.0.0.1" is not a valid URL.`, msg)
|
||||
msg := strings.TrimSpace(doc.Find(".ui.message.flash-message").Text())
|
||||
assert.Equal(t, `RedirectURIs: "ftp://127.0.0.1" is not a valid URL.`, msg)
|
||||
})
|
||||
|
||||
t.Run("OK", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
defer test.MockVariableValue(&setting.OAuth2.CustomSchemes, []string{"my-app"})()
|
||||
req := NewRequestWithValues(t, "POST", "/user/settings/applications/oauth2/2", map[string]string{
|
||||
"application_name": "Test native app",
|
||||
"redirect_uris": "http://127.0.0.1",
|
||||
"confidential_client": "false",
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusSeeOther)
|
||||
|
||||
req = NewRequestWithValues(t, "POST", "/user/settings/applications/oauth2/2", map[string]string{
|
||||
"application_name": "Test native app",
|
||||
"redirect_uris": "my-app://127.0.0.1",
|
||||
"confidential_client": "false",
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusSeeOther)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user