X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmastodon_api%2Fmastodon_api_controller_test.exs;h=02a0eb228572912f3eda9a80dbf31d44eeaef1ad;hb=132d815f1f749cec4b54083fc46046c45e7d0d04;hp=be868c08192944a3c2fbd0a1ed7d27f221f277dc;hpb=d8f446f438716cc1a474c9352e8cca8778a48d85;p=akkoma diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index be868c081..02a0eb228 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -1048,14 +1048,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do user = insert(:user) {:ok, activity_test} = CommonAPI.post(user, %{"status" => "#test"}) - {:ok, activity_test1} = CommonAPI.post(user, %{"status" => "#test1"}) + {:ok, activity_test1} = CommonAPI.post(user, %{"status" => "#test #test1"}) {:ok, activity_none} = CommonAPI.post(user, %{"status" => "#test #none"}) - all_test = + any_test = conn - |> get("/api/v1/timelines/tag/test", %{"all" => ["test1"]}) + |> get("/api/v1/timelines/tag/test", %{"any" => ["test1"]}) - assert [status_none, status_test1, status_test] = json_response(all_test, 200) + [status_none, status_test1, status_test] = json_response(any_test, 200) assert to_string(activity_test.id) == status_test["id"] assert to_string(activity_test1.id) == status_test1["id"] @@ -1065,7 +1065,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do conn |> get("/api/v1/timelines/tag/test", %{"all" => ["test1"], "none" => ["none"]}) - assert [status_test1, status_test] == json_response(restricted_test, 200) + assert [status_test1] == json_response(restricted_test, 200) + + all_test = conn |> get("/api/v1/timelines/tag/test", %{"all" => ["none"]}) + + assert [status_none] == json_response(all_test, 200) end test "getting followers", %{conn: conn} do @@ -1647,5 +1651,32 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do |> post("/api/v1/statuses/#{activity_two.id}/pin") |> json_response(400) end + + test "Status rich-media Card", %{conn: conn, user: user} do + {:ok, activity} = CommonAPI.post(user, %{"status" => "http://example.com/ogp"}) + + response = + conn + |> get("/api/v1/statuses/#{activity.id}/card") + |> json_response(200) + + assert response == %{ + "image" => "http://ia.media-imdb.com/images/rock.jpg", + "provider_name" => "www.imdb.com", + "provider_url" => "http://www.imdb.com", + "title" => "The Rock", + "type" => "link", + "url" => "http://www.imdb.com/title/tt0117500/", + "description" => nil, + "pleroma" => %{ + "opengraph" => %{ + "image" => "http://ia.media-imdb.com/images/rock.jpg", + "title" => "The Rock", + "type" => "video.movie", + "url" => "http://www.imdb.com/title/tt0117500/" + } + } + } + end end end