1 defmodule Pleroma.Web.CommonAPI.UtilsTest do
2 alias Pleroma.Web.CommonAPI.Utils
3 alias Pleroma.Builders.{UserBuilder}
6 test "it adds attachment links to a given text and attachment set" do
8 "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"
11 "url" => [%{"href" => name}]
14 res = Utils.add_attachments("", [attachment])
17 "<br><a href=\"#{name}\" class='attachment'>Sakura Mana – Turned on by a Se…</a>"
20 describe "it confirms the password given is the current users password" do
21 test "with no credentials" do
22 assert Utils.confirm_current_password(nil, %{"password" => "test"}) ==
23 {:error, "Invalid credentials."}
26 test "with incorrect password given" do
27 {:ok, user} = UserBuilder.insert()
29 assert Utils.confirm_current_password(user, %{"password" => ""}) ==
30 {:error, "Invalid password."}
33 test "with correct password given" do
34 {:ok, user} = UserBuilder.insert()
35 assert Utils.confirm_current_password(user, %{"password" => "test"}) == {:ok, user}