|
|
@ -18,17 +18,32 @@ defmodule Pleroma.Web.MetadataTest do
|
|
|
|
test "for local user" do
|
|
|
|
test "for local user" do
|
|
|
|
user = insert(:user)
|
|
|
|
user = insert(:user)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert Pleroma.Web.Metadata.build_tags(%{user: user}) =~
|
|
|
|
|
|
|
|
"<meta content=\"noindex, noarchive\" name=\"robots\">"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "for local user set to discoverable" do
|
|
|
|
|
|
|
|
user = insert(:user, discoverable: true)
|
|
|
|
|
|
|
|
|
|
|
|
refute Pleroma.Web.Metadata.build_tags(%{user: user}) =~
|
|
|
|
refute Pleroma.Web.Metadata.build_tags(%{user: user}) =~
|
|
|
|
"<meta content=\"noindex, noarchive\" name=\"robots\">"
|
|
|
|
"<meta content=\"noindex, noarchive\" name=\"robots\">"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
describe "no metadata for private instances" do
|
|
|
|
describe "no metadata for private instances" do
|
|
|
|
test "for local user" do
|
|
|
|
test "for local user set to discoverable" do
|
|
|
|
clear_config([:instance, :public], false)
|
|
|
|
clear_config([:instance, :public], false)
|
|
|
|
user = insert(:user, bio: "This is my secret fedi account bio")
|
|
|
|
user = insert(:user, bio: "This is my secret fedi account bio", discoverable: true)
|
|
|
|
|
|
|
|
|
|
|
|
assert "" = Pleroma.Web.Metadata.build_tags(%{user: user})
|
|
|
|
assert "" = Pleroma.Web.Metadata.build_tags(%{user: user})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "search exclusion metadata is included" do
|
|
|
|
|
|
|
|
clear_config([:instance, :public], false)
|
|
|
|
|
|
|
|
user = insert(:user, bio: "This is my secret fedi account bio")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert ~s(<meta content="noindex, noarchive" name="robots">) ==
|
|
|
|
|
|
|
|
Pleroma.Web.Metadata.build_tags(%{user: user})
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|