diff options
Diffstat (limited to 'test/web/twitter_api')
4 files changed, 32 insertions, 5 deletions
diff --git a/test/web/twitter_api/representers/activity_representer_test.exs b/test/web/twitter_api/representers/activity_representer_test.exs index e9f6a1915..4f090ee8e 100644 --- a/test/web/twitter_api/representers/activity_representer_test.exs +++ b/test/web/twitter_api/representers/activity_representer_test.exs @@ -27,6 +27,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do assert status["statusnet_conversation_id"] == retweeted_status["statusnet_conversation_id"] assert status["retweeted_status"] == retweeted_status + assert status["activity_type"] == "repeat" end test "a like activity" do @@ -44,6 +45,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do activity_actor = Repo.get_by(User, ap_id: note_activity.data["actor"]) liked_status = ActivityRepresenter.to_map(note_activity, %{user: activity_actor, for: user}) assert liked_status["favorited"] == true + assert status["activity_type"] == "like" end test "an activity" do @@ -127,7 +129,9 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do "favorited" => false, "repeated" => false, "external_url" => "some url", - "tags" => ["content", "mentioning", "nsfw"] + "tags" => ["content", "mentioning", "nsfw"], + "activity_type" => "post", + "possibly_sensitive" => true } assert ActivityRepresenter.to_map(activity, %{user: user, for: follower, mentioned: [mentioned_user]}) == expected_status @@ -142,5 +146,6 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenterTest do map = ActivityRepresenter.to_map(unfollow, %{user: follower}) assert map["is_post_verb"] == false + assert map["activity_type"] == "undo" end end diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 8c689d7d3..89b8c2eeb 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -455,6 +455,22 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do end end + describe "POST /api/account/update_profile.json" do + test "it updates a user's profile" do + user = insert(:user) + + conn = conn + |> assign(:user, user) + |> post("/api/account/update_profile.json", %{"name" => "new name", "description" => "new description"}) + + user = Repo.get!(User, user.id) + assert user.name == "new name" + assert user.bio == "new description" + + assert json_response(conn, 200) == UserView.render("user.json", %{user: user, for: user}) + end + end + defp valid_user(_context) do user = insert(:user) [user: user] diff --git a/test/web/twitter_api/twitter_api_utils_test.exs b/test/web/twitter_api/twitter_api_utils_test.exs index 62aa7843b..ff03414d6 100644 --- a/test/web/twitter_api/twitter_api_utils_test.exs +++ b/test/web/twitter_api/twitter_api_utils_test.exs @@ -3,12 +3,14 @@ defmodule Pleroma.Web.TwitterAPI.UtilsTest do use Pleroma.DataCase test "it adds attachment links to a given text and attachment set" do + name = "Sakura%20Mana%20%E2%80%93%20Turned%20on%20by%20a%20Senior%20OL%20with%20a%20Temptating%20Tight%20Skirt-s%20Full%20Hipline%20and%20Panty%20Shot-%20Beautiful%20Thick%20Thighs-%20and%20Erotic%20Ass-%20-2015-%20--%20Oppaitime%208-28-2017%206-50-33%20PM.png" + attachment = %{ - "url" => [%{"href" => "http://heise.de/i\"m a boy.png"}] + "url" => [%{"href" => name}] } res = Utils.add_attachments("", [attachment]) - assert res == "<br>\n<a href=\"http://heise.de/i%22m%20a%20boy.png\" class='attachment'>i\"m a boy.png</a>" + assert res == "<br>\n<a href=\"#{name}\" class='attachment'>Sakura Mana – Turned on by a Se…</a>" end end diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs index b81d3d64d..7b3289422 100644 --- a/test/web/twitter_api/views/user_view_test.exs +++ b/test/web/twitter_api/views/user_view_test.exs @@ -50,7 +50,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "profile_image_url_original" => image, "following" => false, "rights" => %{}, - "statusnet_profile_url" => user.ap_id + "statusnet_profile_url" => user.ap_id, + "cover_photo" => nil, + "background_image" => nil } assert represented == UserView.render("show.json", %{user: user}) @@ -76,7 +78,9 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do "profile_image_url_original" => image, "following" => true, "rights" => %{}, - "statusnet_profile_url" => user.ap_id + "statusnet_profile_url" => user.ap_id, + "cover_photo" => nil, + "background_image" => nil } assert represented == UserView.render("show.json", %{user: user, for: follower}) |