1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.RelMeTest do
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, []}
18 assert {:ok, %Tesla.Env{status: 404}} =
19 Pleroma.Web.RelMe.parse("http://example.com/rel_me/error")
21 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/link") == {:ok, hrefs}
22 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor") == {:ok, hrefs}
23 assert Pleroma.Web.RelMe.parse("http://example.com/rel_me/anchor_nofollow") == {:ok, hrefs}
26 test "maybe_put_rel_me/2" do
27 profile_urls = ["https://social.example.org/users/lain"]
31 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/null", profile_urls) ==
34 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/error", profile_urls) ==
37 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/anchor", profile_urls) ==
40 assert Pleroma.Web.RelMe.maybe_put_rel_me(
41 "http://example.com/rel_me/anchor_nofollow",
45 assert Pleroma.Web.RelMe.maybe_put_rel_me("http://example.com/rel_me/link", profile_urls) ==