diff options
author | Jason Song <i@wolfogre.com> | 2024-09-30 10:28:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 02:28:09 +0000 |
commit | 13283873e9d523d5a5557f55d64f702c1a9f76ec (patch) | |
tree | 64d279628645732743129a23868f304f01bc3a3f /tests/integration/org_test.go | |
parent | 5015de4d9ae0765e7f79073a638d8da3a931f05b (diff) | |
download | gitea-13283873e9d523d5a5557f55d64f702c1a9f76ec.tar.gz gitea-13283873e9d523d5a5557f55d64f702c1a9f76ec.zip |
Ensure `GetCSRF` doesn't return an empty token (#32130)
Since page templates keep changing, some pages that contained forms with
CSRF token no longer have them.
It leads to some calls of `GetCSRF` returning an empty string, which
fails the tests. Like
https://github.com/go-gitea/gitea/blob/3269b04d61ffe6a7ce462cd05ee150e4491124e8/tests/integration/attachment_test.go#L62-L63
The test did try to get the CSRF token and provided it, but it was
empty.
Diffstat (limited to 'tests/integration/org_test.go')
-rw-r--r-- | tests/integration/org_test.go | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/tests/integration/org_test.go b/tests/integration/org_test.go index 94c4e19727..ef4ef2bb9b 100644 --- a/tests/integration/org_test.go +++ b/tests/integration/org_test.go @@ -204,9 +204,7 @@ func TestTeamSearch(t *testing.T) { var results TeamSearchResults session := loginUser(t, user.Name) - csrf := GetCSRF(t, session, "/"+org.Name) req := NewRequestf(t, "GET", "/org/%s/teams/-/search?q=%s", org.Name, "_team") - req.Header.Add("X-Csrf-Token", csrf) resp := session.MakeRequest(t, req, http.StatusOK) DecodeJSON(t, resp, &results) assert.NotEmpty(t, results.Data) @@ -217,8 +215,6 @@ func TestTeamSearch(t *testing.T) { // no access if not organization member user5 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 5}) session = loginUser(t, user5.Name) - csrf = GetCSRF(t, session, "/"+org.Name) req = NewRequestf(t, "GET", "/org/%s/teams/-/search?q=%s", org.Name, "team") - req.Header.Add("X-Csrf-Token", csrf) session.MakeRequest(t, req, http.StatusNotFound) } |