diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs index 665efb9ca..15aa1243b 100644 --- a/test/pleroma/web/metadata/utils_test.exs +++ b/test/pleroma/web/metadata/utils_test.exs @@ -77,4 +77,32 @@ test "it returns text without encode HTML" do assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!" end end + + describe "user_name_string/1" do + test "it uses the Endpoint by default" do + Pleroma.Web.Endpoint.config_change( + [{Pleroma.Web.Endpoint, url: [host: "sub.example.com"]}], + [] + ) + + user = insert(:user) + + assert Utils.user_name_string(user) == "#{user.name} (@#{user.nickname}@sub.example.com)" + end + + test "it uses any custom WebFinger domain" do + Pleroma.Web.Endpoint.config_change( + [{Pleroma.Web.Endpoint, url: [host: "sub.example.com"]}], + [] + ) + + clear_config([Pleroma.Web.Endpoint, :url, :host], "sub.example.com") + + clear_config([Pleroma.Web.WebFinger, :domain], "example.com") + + user = insert(:user) + + assert Utils.user_name_string(user) == "#{user.name} (@#{user.nickname}@example.com)" + end + end end diff --git a/test/pleroma/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs index f2e8e4717..47e72662c 100644 --- a/test/pleroma/web/web_finger/web_finger_controller_test.exs +++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs @@ -61,8 +61,6 @@ test "reach user on tld, while pleroma is runned on subdomain" do user = insert(:user, ap_id: "https://sub.example.com/users/bobby", nickname: "bobby") - assert Utils.user_name_string(user) == "#{user.name} (@bobby@example.com)" - response = build_conn() |> put_req_header("accept", "application/jrd+json")