Update test for custom fields when name empty string
authorkPherox <admin@mail.kr-kp.com>
Sun, 25 Aug 2019 18:25:06 +0000 (03:25 +0900)
committerkPherox <admin@mail.kr-kp.com>
Sun, 25 Aug 2019 18:30:31 +0000 (03:30 +0900)
test/web/mastodon_api/mastodon_api_controller/update_credentials_test.exs

index b1a5c2aeaddcfde98577d398e6ab81c9fc0f0065..21dae98fa2dfe6b0a09276bf2bbcde2040c54a61 100644 (file)
@@ -364,6 +364,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do
                |> assign(:user, user)
                |> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
                |> json_response(403)
+
+      fields = [
+        %{"name" => "foo", "value" => ""},
+        %{"name" => "", "value" => "bar"}
+      ]
+
+      account =
+        conn
+        |> assign(:user, user)
+        |> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
+        |> json_response(200)
+
+      assert account["fields"] == [
+               %{"name" => "foo", "value" => ""}
+             ]
     end
   end
 end