2020-04-01 06:55:05 +00:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-01 11:11:47 +00:00
|
|
|
# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
|
2020-04-01 06:55:05 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
defmodule Pleroma.Web.Metadata.Providers.RestrictIndexingTest do
|
|
|
|
use ExUnit.Case, async: true
|
|
|
|
|
|
|
|
describe "build_tags/1" do
|
|
|
|
test "for remote user" do
|
|
|
|
assert Pleroma.Web.Metadata.Providers.RestrictIndexing.build_tags(%{
|
|
|
|
user: %Pleroma.User{local: false}
|
|
|
|
}) == [{:meta, [name: "robots", content: "noindex, noarchive"], []}]
|
|
|
|
end
|
|
|
|
|
|
|
|
test "for local user" do
|
|
|
|
assert Pleroma.Web.Metadata.Providers.RestrictIndexing.build_tags(%{
|
2020-10-13 14:45:08 +00:00
|
|
|
user: %Pleroma.User{local: true, is_discoverable: true}
|
2020-04-01 06:55:05 +00:00
|
|
|
}) == []
|
|
|
|
end
|
2020-09-14 17:18:11 +00:00
|
|
|
|
2020-11-19 16:30:02 +00:00
|
|
|
test "for local user when `is_discoverable` is false" do
|
2020-09-14 17:18:11 +00:00
|
|
|
assert Pleroma.Web.Metadata.Providers.RestrictIndexing.build_tags(%{
|
2020-10-13 14:45:08 +00:00
|
|
|
user: %Pleroma.User{local: true, is_discoverable: false}
|
2020-09-14 17:18:11 +00:00
|
|
|
}) == [{:meta, [name: "robots", content: "noindex, noarchive"], []}]
|
|
|
|
end
|
2020-04-01 06:55:05 +00:00
|
|
|
end
|
|
|
|
end
|