diff options
author | lain <lain@soykaf.club> | 2019-06-22 15:12:57 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-06-22 15:12:57 +0200 |
commit | 58c4d5312bcf461fdff2984bad61d40cd1f5677a (patch) | |
tree | 0899b6dae0cbc5643a6187543cbd56bc5882b151 /test/web/rich_media/parser_test.exs | |
parent | 8dbcff2fed0bf6fb20b70388974fcbe9d3a0aeee (diff) | |
download | pleroma-58c4d5312bcf461fdff2984bad61d40cd1f5677a.tar.gz pleroma-58c4d5312bcf461fdff2984bad61d40cd1f5677a.zip |
Revert "Revert "Merge branch 'fix/ogp-title' into 'develop'""
This reverts commit b6af80f769195b5047ee8da07166f022c2e29b0a.
Diffstat (limited to 'test/web/rich_media/parser_test.exs')
-rw-r--r-- | test/web/rich_media/parser_test.exs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/web/rich_media/parser_test.exs b/test/web/rich_media/parser_test.exs index 3a9cc1854..a49ba9549 100644 --- a/test/web/rich_media/parser_test.exs +++ b/test/web/rich_media/parser_test.exs @@ -11,6 +11,15 @@ defmodule Pleroma.Web.RichMedia.ParserTest do %{ method: :get, + url: "http://example.com/ogp-missing-title" + } -> + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/rich_media/ogp-missing-title.html") + } + + %{ + method: :get, url: "http://example.com/twitter-card" } -> %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/twitter_card.html")} @@ -51,6 +60,19 @@ defmodule Pleroma.Web.RichMedia.ParserTest do }} end + test "falls back to <title> when ogp:title is missing" do + assert Pleroma.Web.RichMedia.Parser.parse("http://example.com/ogp-missing-title") == + {:ok, + %{ + image: "http://ia.media-imdb.com/images/rock.jpg", + title: "The Rock (1996)", + description: + "Directed by Michael Bay. With Sean Connery, Nicolas Cage, Ed Harris, John Spencer.", + type: "video.movie", + url: "http://www.imdb.com/title/tt0117500/" + }} + end + test "parses twitter card" do assert Pleroma.Web.RichMedia.Parser.parse("http://example.com/twitter-card") == {:ok, |