diff options
| author | lain <lain@soykaf.club> | 2019-06-13 13:26:39 +0000 | 
|---|---|---|
| committer | lain <lain@soykaf.club> | 2019-06-13 13:26:39 +0000 | 
| commit | 6f5a0cc14e99cb26ef009cf8cf16f38902d5e11b (patch) | |
| tree | 2fa88e68d4f690420a48b3cbe84296f7b759cb0e /test/web | |
| parent | a2318e9dd6c8daf5554b17e9312f1fb6e14326de (diff) | |
| parent | 163fa180f5b06ca49464dd06a4fed64aed0c97bf (diff) | |
| download | pleroma-6f5a0cc14e99cb26ef009cf8cf16f38902d5e11b.tar.gz pleroma-6f5a0cc14e99cb26ef009cf8cf16f38902d5e11b.zip  | |
Merge branch 'fix/ogp-title' into 'develop'
Rich Media Parser: Attempt to use <title> from HTML as a fallback
Closes #979
See merge request pleroma/pleroma!1277
Diffstat (limited to 'test/web')
| -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,  | 
