summaryrefslogtreecommitdiff
path: root/test/web/rich_media/parser_test.exs
blob: bb0d663e9e576e0865cdc15aafda62d2bd5979f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
defmodule Pleroma.Web.RichMedia.ParserTest do
  use ExUnit.Case, async: true

  setup do
    Tesla.Mock.mock(fn
      %{
        method: :get,
        url: "http://example.com/ogp"
      } ->
        %Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}
    end)

    :ok
  end

  test "parses ogp" do
    assert Pleroma.Web.RichMedia.Parser.parse("http://example.com/ogp") ==
             %Pleroma.Web.RichMedia.Data{
               description: nil,
               image: "http://ia.media-imdb.com/images/rock.jpg",
               title: "The Rock",
               type: "video.movie",
               url: "http://www.imdb.com/title/tt0117500/"
             }
  end
end