diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2018-12-04 18:35:57 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2018-12-04 18:35:57 +0300 |
commit | 826fc446d56b48b67e97144c74bbf74109fb8168 (patch) | |
tree | 3c9d30f3c28cb5f30746f55c6b04f4dd0db8d97d /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | 88b05aeabb23412530f6b74934bc3d2d3fe8c29f (diff) | |
download | pleroma-826fc446d56b48b67e97144c74bbf74109fb8168.tar.gz pleroma-826fc446d56b48b67e97144c74bbf74109fb8168.zip |
[#210] TwitterAPI: implemented /api/media/metadata/create
to allow uploads description (alt text) setting.
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index a6495ffc1..8faa4b58e 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -1253,4 +1253,24 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do assert [user.id, user_two.id, user_three.id] == Enum.map(resp, fn %{"id" => id} -> id end) end end + + describe "POST /api/media/metadata/create" do + test "it updates `data[name]` of referenced Object with provided value", %{conn: conn} do + user = insert(:user) + object = insert(:note) + description = "Informative description of the image. Initial: #{object.data["name"]}}" + + _conn = + conn + |> assign(:user, user) + |> post("/api/media/metadata/create.json", %{ + "media_id" => object.id, + "alt_text" => %{"text" => description} + }) + |> json_response(:no_content) + + object = Repo.get!(Object, object.id) + assert object.data["name"] == description + end + end end |