mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-25 02:19:31 +00:00
Update test for custom fields when content-type urlencoded
This commit is contained in:
parent
b8777b01ae
commit
eb75ea502d
|
@ -329,6 +329,35 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
|
||||||
%{"name" => "link", "value" => "cofe.io"}
|
%{"name" => "link", "value" => "cofe.io"}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
fields =
|
||||||
|
[
|
||||||
|
"fields_attributes[1][name]=link",
|
||||||
|
"fields_attributes[1][value]=cofe.io",
|
||||||
|
"fields_attributes[0][name]=<a href=\"http://google.com\">foo</a>",
|
||||||
|
"fields_attributes[0][value]=bar"
|
||||||
|
]
|
||||||
|
|> Enum.join("&")
|
||||||
|
|
||||||
|
account =
|
||||||
|
conn
|
||||||
|
|> put_req_header("content-type", "application/x-www-form-urlencoded")
|
||||||
|
|> assign(:user, user)
|
||||||
|
|> patch("/api/v1/accounts/update_credentials", fields)
|
||||||
|
|> json_response(200)
|
||||||
|
|
||||||
|
assert account["fields"] == [
|
||||||
|
%{"name" => "foo", "value" => "bar"},
|
||||||
|
%{"name" => "link", "value" => "<a href=\"http://cofe.io\">cofe.io</a>"}
|
||||||
|
]
|
||||||
|
|
||||||
|
assert account["source"]["fields"] == [
|
||||||
|
%{
|
||||||
|
"name" => "<a href=\"http://google.com\">foo</a>",
|
||||||
|
"value" => "bar"
|
||||||
|
},
|
||||||
|
%{"name" => "link", "value" => "cofe.io"}
|
||||||
|
]
|
||||||
|
|
||||||
name_limit = Pleroma.Config.get([:instance, :account_field_name_length])
|
name_limit = Pleroma.Config.get([:instance, :account_field_name_length])
|
||||||
value_limit = Pleroma.Config.get([:instance, :account_field_value_length])
|
value_limit = Pleroma.Config.get([:instance, :account_field_value_length])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue