diff options
author | Maxim Filippov <colixer@gmail.com> | 2019-01-10 18:09:56 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-01-10 18:09:56 +0000 |
commit | 1f851a07232e510e82e7b13400dfcb31cca555bb (patch) | |
tree | 05a97bdae755e1ace599be00eb6ed69eb52a32b3 /test/web/rich_media/parser_test.exs | |
parent | 11d08c622606030492a3938d7287a85af49f23a5 (diff) | |
download | pleroma-1f851a07232e510e82e7b13400dfcb31cca555bb.tar.gz pleroma-1f851a07232e510e82e7b13400dfcb31cca555bb.zip |
Add Twitter Card parser
Diffstat (limited to 'test/web/rich_media/parser_test.exs')
-rw-r--r-- | test/web/rich_media/parser_test.exs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/rich_media/parser_test.exs b/test/web/rich_media/parser_test.exs index caf81e9fa..ff3486a6d 100644 --- a/test/web/rich_media/parser_test.exs +++ b/test/web/rich_media/parser_test.exs @@ -9,6 +9,12 @@ defmodule Pleroma.Web.RichMedia.ParserTest do } -> %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")} + %{ + method: :get, + url: "http://example.com/twitter-card" + } -> + %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/twitter_card.html")} + %{method: :get, url: "http://example.com/empty"} -> %Tesla.Env{status: 200, body: "hello"} end) @@ -30,4 +36,16 @@ defmodule Pleroma.Web.RichMedia.ParserTest do 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, + %{ + card: "summary", + site: "@flickr", + image: "https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg", + title: "Small Island Developing States Photo Submission", + description: "View the album on Flickr." + }} + end end |