1 defmodule Pleroma.Web.RichMedia.ParserTest do
2 use ExUnit.Case, async: true
8 url: "http://example.com/ogp"
10 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}
14 url: "http://example.com/twitter-card"
16 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/twitter_card.html")}
18 %{method: :get, url: "http://example.com/empty"} ->
19 %Tesla.Env{status: 200, body: "hello"}
25 test "returns error when no metadata present" do
26 assert {:error, _} = Pleroma.Web.RichMedia.Parser.parse("http://example.com/empty")
30 assert Pleroma.Web.RichMedia.Parser.parse("http://example.com/ogp") ==
33 image: "http://ia.media-imdb.com/images/rock.jpg",
36 url: "http://www.imdb.com/title/tt0117500/"
40 test "parses twitter card" do
41 assert Pleroma.Web.RichMedia.Parser.parse("http://example.com/twitter-card") ==
46 image: "https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg",
47 title: "Small Island Developing States Photo Submission",
48 description: "View the album on Flickr."