bb0d663e9e576e0865cdc15aafda62d2bd5979f5
[akkoma] / test / web / rich_media / parser_test.exs
1 defmodule Pleroma.Web.RichMedia.ParserTest do
2 use ExUnit.Case, async: true
3
4 setup do
5 Tesla.Mock.mock(fn
6 %{
7 method: :get,
8 url: "http://example.com/ogp"
9 } ->
10 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}
11 end)
12
13 :ok
14 end
15
16 test "parses ogp" do
17 assert Pleroma.Web.RichMedia.Parser.parse("http://example.com/ogp") ==
18 %Pleroma.Web.RichMedia.Data{
19 description: nil,
20 image: "http://ia.media-imdb.com/images/rock.jpg",
21 title: "The Rock",
22 type: "video.movie",
23 url: "http://www.imdb.com/title/tt0117500/"
24 }
25 end
26 end