diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-10-02 20:42:40 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-10-02 20:42:40 +0300 |
commit | 64095961fe490029886cae358683532ea65bf2c0 (patch) | |
tree | 017731144aa638372b9ed356642c01920033618a /test/web/twitter_api/password_controller_test.exs | |
parent | 6f67aed3acf557bb1e37415af82acd97e46c9ac4 (diff) | |
parent | a22a7437d84065192601f73da73d2c27111c9b15 (diff) | |
download | pleroma-64095961fe490029886cae358683532ea65bf2c0.tar.gz pleroma-64095961fe490029886cae358683532ea65bf2c0.zip |
[#1234] Merge remote-tracking branch 'remotes/upstream/develop' into 1234-mastodon-2-4-3-oauth-scopes
# Conflicts:
# CHANGELOG.md
# lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex
# lib/pleroma/web/router.ex
Diffstat (limited to 'test/web/twitter_api/password_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/password_controller_test.exs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/web/twitter_api/password_controller_test.exs b/test/web/twitter_api/password_controller_test.exs index 3a7246ea8..dc6d4e3e3 100644 --- a/test/web/twitter_api/password_controller_test.exs +++ b/test/web/twitter_api/password_controller_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do use Pleroma.Web.ConnCase alias Pleroma.PasswordResetToken + alias Pleroma.User alias Pleroma.Web.OAuth.Token import Pleroma.Factory @@ -56,5 +57,25 @@ defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do assert Comeonin.Pbkdf2.checkpw("test", user.password_hash) assert length(Token.get_user_tokens(user)) == 0 end + + test "it sets password_reset_pending to false", %{conn: conn} do + user = insert(:user, info: %{password_reset_pending: true}) + + {:ok, token} = PasswordResetToken.create_token(user) + {:ok, _access_token} = Token.create_token(insert(:oauth_app), user, %{}) + + params = %{ + "password" => "test", + password_confirmation: "test", + token: token.token + } + + conn + |> assign(:user, user) + |> post("/api/pleroma/password_reset", %{data: params}) + |> html_response(:ok) + + assert User.get_by_id(user.id).info.password_reset_pending == false + end end end |