1 defmodule Pleroma.Web.RelMeTest do
2 use ExUnit.Case, async: true
8 url: "http://example.com/rel_me/anchor"
10 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor.html")}
14 url: "http://example.com/rel_me/anchor_nofollow"
16 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_anchor_nofollow.html")}
20 url: "http://example.com/rel_me/link"
22 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_link.html")}
26 url: "http://example.com/rel_me/null"
28 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_null.html")}
35 hrefs = ["https://social.example.org/users/lain"]
37 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/null") == {:ok, []}
38 assert {:error, _} = Pleroma.Web.RelMe.parse("http://example.com/rel_me/error")
40 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/link") == {:ok, hrefs}
41 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor") == {:ok, hrefs}
42 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor_nofollow") == {:ok, hrefs}
45 test "maybe_put_rel_me/2" do
46 profile_urls = ["https://social.example.org/users/lain"]
50 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
53 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
56 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
59 assert Pleroma.Web.RelMe.maybe_put_rel_me(
60 "http://example.com/rel_me/anchor_nofollow",
64 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/link", profile_urls) ==