Remove test validating missing descriptions are returned as an empty string
This commit is contained in:
parent
688748b531
commit
f4daa90bd8
1 changed files with 57 additions and 0 deletions
|
@ -1446,6 +1446,63 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "cards" do
|
||||||
|
setup do
|
||||||
|
Pleroma.StaticStubbedConfigMock
|
||||||
|
|> stub(:get, fn
|
||||||
|
[:rich_media, :enabled] -> true
|
||||||
|
path -> Pleroma.Test.StaticConfig.get(path)
|
||||||
|
end)
|
||||||
|
|
||||||
|
oauth_access(["read:statuses"])
|
||||||
|
end
|
||||||
|
|
||||||
|
test "returns rich-media card", %{conn: conn, user: user} do
|
||||||
|
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||||
|
|
||||||
|
{:ok, activity} = CommonAPI.post(user, %{status: "https://example.com/ogp"})
|
||||||
|
|
||||||
|
card_data = %{
|
||||||
|
"image" => "http://ia.media-imdb.com/images/rock.jpg",
|
||||||
|
"provider_name" => "example.com",
|
||||||
|
"provider_url" => "https://example.com",
|
||||||
|
"title" => "The Rock",
|
||||||
|
"type" => "link",
|
||||||
|
"url" => "https://example.com/ogp",
|
||||||
|
"description" =>
|
||||||
|
"Directed by Michael Bay. With Sean Connery, Nicolas Cage, Ed Harris, John Spencer.",
|
||||||
|
"pleroma" => %{
|
||||||
|
"opengraph" => %{
|
||||||
|
"image" => "http://ia.media-imdb.com/images/rock.jpg",
|
||||||
|
"title" => "The Rock",
|
||||||
|
"type" => "video.movie",
|
||||||
|
"url" => "https://example.com/ogp",
|
||||||
|
"description" =>
|
||||||
|
"Directed by Michael Bay. With Sean Connery, Nicolas Cage, Ed Harris, John Spencer."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/statuses/#{activity.id}/card")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert response == card_data
|
||||||
|
|
||||||
|
# works with private posts
|
||||||
|
{:ok, activity} =
|
||||||
|
CommonAPI.post(user, %{status: "https://example.com/ogp", visibility: "direct"})
|
||||||
|
|
||||||
|
response_two =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/statuses/#{activity.id}/card")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
|
assert response_two == card_data
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test "bookmarks" do
|
test "bookmarks" do
|
||||||
bookmarks_uri = "/api/v1/bookmarks"
|
bookmarks_uri = "/api/v1/bookmarks"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue