update tests

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-11-23 00:13:06 +01:00
parent 5ff3783d01
commit c03852fbc7

View file

@ -2678,13 +2678,25 @@ defmodule Pleroma.UserTest do
end end
describe "full_nickname/1" do describe "full_nickname/1" do
test "returns fully qualified nickname for local and remote users" do test "returns fully qualified nickname for local users" do
local_user = local_user = insert(:user, nickname: "local_user")
insert(:user, nickname: "local_user", ap_id: "https://somehost.com/users/local_user")
assert User.full_nickname(local_user) == "local_user@localhost"
end
test "returns fully qualified nickname for local users when using different domain for webfinger" do
clear_config([Pleroma.Web.WebFinger, :domain], "plemora.dev")
host = Pleroma.Web.Endpoint.host()
local_user = insert(:user, nickname: "local_user")
assert User.full_nickname(local_user) == "local_user@plemora.dev"
end
test "returns fully qualified nickname for remote users" do
remote_user = insert(:user, nickname: "remote@host.com", local: false) remote_user = insert(:user, nickname: "remote@host.com", local: false)
assert User.full_nickname(local_user) == "local_user@somehost.com"
assert User.full_nickname(remote_user) == "remote@host.com" assert User.full_nickname(remote_user) == "remote@host.com"
end end