mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
[TESTS] webhook forms keep submitted data when invalid
This commit is contained in:
parent
1e050d01c0
commit
635230ca5d
3 changed files with 42 additions and 15 deletions
|
@ -330,7 +330,16 @@ func testWebhookForms(name string, session *TestSession, validFields map[string]
|
|||
}
|
||||
}
|
||||
|
||||
session.MakeRequest(t, NewRequestWithValues(t, "POST", "/user2/repo1/settings/hooks/"+name+"/new", payload), http.StatusUnprocessableEntity)
|
||||
resp := session.MakeRequest(t, NewRequestWithValues(t, "POST", "/user2/repo1/settings/hooks/"+name+"/new", payload), http.StatusUnprocessableEntity)
|
||||
// check that the invalid form is pre-filled
|
||||
htmlForm = NewHTMLParser(t, resp.Body).Find(`form[action^="/user2/repo1/settings/hooks/"]`)
|
||||
for k, v := range payload {
|
||||
if k == "_csrf" || k == "events" || v == "" {
|
||||
// the 'events' is a radio input, which is buggy below
|
||||
continue
|
||||
}
|
||||
assert.Equal(t, v, assertInput(t, htmlForm, k), "input %q did not contain value %q", k, v)
|
||||
}
|
||||
if t.Failed() {
|
||||
t.Log(invalidPatch)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue