1 defmodule Pleroma.Web.CommonAPI.UtilsTest do
2 alias Pleroma.Web.CommonAPI.Utils
3 alias Pleroma.Web.Endpoint
4 alias Pleroma.Builders.{UserBuilder}
7 test "it adds attachment links to a given text and attachment set" do
9 "Sakura%20Mana%20%E2%80%93%20Turned%20on%20by%20a%20Senior%20OL%20with%20a%20Temptating%20Tight%20Skirt-s%20Full%20Hipline%20and%20Panty%20Shot-%20Beautiful%20Thick%20Thighs-%20and%20Erotic%20Ass-%20-2015-%20--%20Oppaitime%208-28-2017%206-50-33%20PM.png"
12 "url" => [%{"href" => name}]
15 res = Utils.add_attachments("", [attachment])
18 "<br><a href=\"#{name}\" class='attachment'>Sakura Mana – Turned on by a Se…</a>"
21 describe "it confirms the password given is the current users password" do
22 test "incorrect password given" do
23 {:ok, user} = UserBuilder.insert()
25 assert Utils.confirm_current_password(user, "") == {:error, "Invalid password."}
28 test "correct password given" do
29 {:ok, user} = UserBuilder.insert()
30 assert Utils.confirm_current_password(user, "test") == {:ok, user}
34 test "parses emoji from name and bio" do
35 {:ok, user} = UserBuilder.insert(%{name: ":karjalanpiirakka:", bio: ":perkele:"})
40 "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}/finmoji/128px/perkele-128.png"},
47 "url" => "#{Endpoint.url()}/finmoji/128px/karjalanpiirakka-128.png"
49 "name" => ":karjalanpiirakka:"
53 assert expected == Utils.emoji_from_profile(user)