1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.RelMeTest do
6 use ExUnit.Case, async: true
9 Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
14 hrefs = ["https://social.example.org/users/lain"]
16 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/null") == {:ok, []}
17 assert {:error, _} = Pleroma.Web.RelMe.parse("http://example.com/rel_me/error")
19 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/link") == {:ok, hrefs}
20 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor") == {:ok, hrefs}
21 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor_nofollow") == {:ok, hrefs}
24 test "maybe_put_rel_me/2" do
25 profile_urls = ["https://social.example.org/users/lain"]
29 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
32 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
35 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
38 assert Pleroma.Web.RelMe.maybe_put_rel_me(
39 "http://example.com/rel_me/anchor_nofollow",
43 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/link", profile_urls) ==