diff options
author | csaurus <csaurus@mailbox.org> | 2018-05-21 20:19:37 -0400 |
---|---|---|
committer | csaurus <csaurus@mailbox.org> | 2018-05-21 20:19:37 -0400 |
commit | 4fd9df100f61dfe4731934eca86500472d866f60 (patch) | |
tree | 736ff0c55cde3890018a189edb8993ce4dead80b /test/web/common_api/common_api_utils_test.exs | |
parent | d0ad13c12e1410e7a11d5a5f7f5b84cad5f77732 (diff) | |
parent | b4064dfe30b792f5d6d36b72c7cd530afb1c667a (diff) | |
download | pleroma-4fd9df100f61dfe4731934eca86500472d866f60.tar.gz |
Merge branch 'develop' into feature/mstdn-direct-api
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r-- | test/web/common_api/common_api_utils_test.exs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs index 689bdd61e..23cce471f 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/web/common_api/common_api_utils_test.exs @@ -1,5 +1,6 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do alias Pleroma.Web.CommonAPI.Utils + alias Pleroma.Builders.{UserBuilder} use Pleroma.DataCase test "it adds attachment links to a given text and attachment set" do @@ -15,4 +16,18 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do assert res == "<br><a href=\"#{name}\" class='attachment'>Sakura Mana – Turned on by a Se…</a>" end + + describe "it confirms the password given is the current users password" do + test "incorrect password given" do + {:ok, user} = UserBuilder.insert() + + assert Utils.confirm_current_password(user, %{"password" => ""}) == + {:error, "Invalid password."} + end + + test "correct password given" do + {:ok, user} = UserBuilder.insert() + assert Utils.confirm_current_password(user, %{"password" => "test"}) == {:ok, user} + end + end end |