mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-14 09:37:29 -06:00
[feature] Add support for profile fields (#1483)
* Add go-playground/form pkg * [feature] Add support for profile fields * Add field attributes test * Validate profile fields form * Add profile field validation tests * Add Field Attributes definition to swagger --------- Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
This commit is contained in:
parent
24f6a447f3
commit
f518f649f8
21 changed files with 2399 additions and 2 deletions
|
|
@ -38,12 +38,14 @@ type AccountUpdateTestSuite struct {
|
|||
|
||||
func (suite *AccountUpdateTestSuite) TestAccountUpdateCredentialsPATCHHandler() {
|
||||
// set up the request
|
||||
// we're updating the note of zork
|
||||
// we're updating the note and profile fields of zork
|
||||
newBio := "this is my new bio read it and weep"
|
||||
requestBody, w, err := testrig.CreateMultipartFormData(
|
||||
"", "",
|
||||
map[string]string{
|
||||
"note": newBio,
|
||||
"note": newBio,
|
||||
"fields_attributes[0][name]": "pronouns",
|
||||
"fields_attributes[0][value]": "they/them",
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
@ -74,6 +76,7 @@ func (suite *AccountUpdateTestSuite) TestAccountUpdateCredentialsPATCHHandler()
|
|||
// check the returned api model account
|
||||
// fields should be updated
|
||||
suite.Equal("<p>this is my new bio read it and weep</p>", apimodelAccount.Note)
|
||||
suite.Equal("they/them", apimodelAccount.Fields[0].Value)
|
||||
suite.Equal(newBio, apimodelAccount.Source.Note)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue