diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-02-11 13:54:21 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-02-11 13:54:21 +0700 |
commit | 305d2194136d4560e02c110d528164034d3727b2 (patch) | |
tree | 40510e1c4dc0140ff16e2fdc483da64c83b7077c /test/web/mastodon_api | |
parent | 5b1d7c3c5672af065af503891d156b6e0cf5a8c1 (diff) | |
parent | 06c4935c11fc58f5ede18706bc46dcc502e64052 (diff) | |
download | pleroma-305d2194136d4560e02c110d528164034d3727b2.tar.gz pleroma-305d2194136d4560e02c110d528164034d3727b2.zip |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/jobs
# Conflicts:
# lib/pleroma/web/federator/federator.ex
# lib/pleroma/web/websub/websub.ex
Diffstat (limited to 'test/web/mastodon_api')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 8 | ||||
-rw-r--r-- | test/web/mastodon_api/status_view_test.exs | 55 |
2 files changed, 59 insertions, 4 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index d4e2acae3..f8da86004 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1139,8 +1139,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert id == to_string(other_user.id) end - test "getting following, hide_followings", %{conn: conn} do - user = insert(:user, %{info: %{hide_followings: true}}) + test "getting following, hide_follows", %{conn: conn} do + user = insert(:user, %{info: %{hide_follows: true}}) other_user = insert(:user) {:ok, user} = User.follow(user, other_user) @@ -1151,8 +1151,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do assert [] == json_response(conn, 200) end - test "getting following, hide_followings, same user requesting", %{conn: conn} do - user = insert(:user, %{info: %{hide_followings: true}}) + test "getting following, hide_follows, same user requesting", %{conn: conn} do + user = insert(:user, %{info: %{hide_follows: true}}) other_user = insert(:user) {:ok, user} = User.follow(user, other_user) diff --git a/test/web/mastodon_api/status_view_test.exs b/test/web/mastodon_api/status_view_test.exs index c6a5783c6..2106253f2 100644 --- a/test/web/mastodon_api/status_view_test.exs +++ b/test/web/mastodon_api/status_view_test.exs @@ -235,4 +235,59 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do ] end end + + describe "rich media cards" do + test "a rich media card without a site name renders correctly" do + page_url = "http://example.com" + + card = %{ + url: page_url, + image: page_url <> "/example.jpg", + title: "Example website" + } + + %{provider_name: "example.com"} = + StatusView.render("card.json", %{page_url: page_url, rich_media: card}) + end + + test "a rich media card without a site name or image renders correctly" do + page_url = "http://example.com" + + card = %{ + url: page_url, + title: "Example website" + } + + %{provider_name: "example.com"} = + StatusView.render("card.json", %{page_url: page_url, rich_media: card}) + end + + test "a rich media card without an image renders correctly" do + page_url = "http://example.com" + + card = %{ + url: page_url, + site_name: "Example site name", + title: "Example website" + } + + %{provider_name: "Example site name"} = + StatusView.render("card.json", %{page_url: page_url, rich_media: card}) + end + + test "a rich media card with all relevant data renders correctly" do + page_url = "http://example.com" + + card = %{ + url: page_url, + site_name: "Example site name", + title: "Example website", + image: page_url <> "/example.jpg", + description: "Example description" + } + + %{provider_name: "Example site name"} = + StatusView.render("card.json", %{page_url: page_url, rich_media: card}) + end + end end |