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/link"
16 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_link.html")}
20 url: "http://example.com/rel_me/null"
22 %Tesla.Env{status: 200, body: File.read!("test/fixtures/rel_me_null.html")}
29 hrefs = ["https://social.example.org/users/lain"]
31 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/null") == {:ok, []}
32 assert {:error, _} = Pleroma.Web.RelMe.parse("http://example.com/rel_me/error")
34 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/link") == {:ok, hrefs}
35 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor") == {:ok, hrefs}
38 test "maybe_put_rel_me/2" do
39 profile_urls = ["https://social.example.org/users/lain"]
43 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
46 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
49 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
52 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/link", profile_urls) ==