diff options
author | Francis Dinh <normandy@firemail.cc> | 2018-05-20 19:17:15 -0400 |
---|---|---|
committer | Francis Dinh <normandy@firemail.cc> | 2018-05-20 19:17:15 -0400 |
commit | 1afd6d37bd2febb58ee09d273b9c7d690022d3c3 (patch) | |
tree | 8be53801457cae7e31f7efdb501b81974ca3b36f /test/web/twitter_api/twitter_api_controller_test.exs | |
parent | d46393f6efd6475bb20b6a12a7c6ebf800f6c5b5 (diff) | |
parent | 961f1312571843209487cc1caa9355fa6552d965 (diff) | |
download | pleroma-1afd6d37bd2febb58ee09d273b9c7d690022d3c3.tar.gz pleroma-1afd6d37bd2febb58ee09d273b9c7d690022d3c3.zip |
Merge remote-tracking branch 'upstream/develop' into feature/incoming-remote-unfollow
Fixed some conflicts in transmogrifier.ex
Diffstat (limited to 'test/web/twitter_api/twitter_api_controller_test.exs')
-rw-r--r-- | test/web/twitter_api/twitter_api_controller_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 896fe246d..02aba0bc8 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -800,4 +800,31 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do user = Repo.get!(User, user.id) assert user.bio == "Hello,<br>World! I<br> am a test." end + + describe "POST /api/pleroma/delete_account" do + setup [:valid_user] + + test "without credentials", %{conn: conn} do + conn = post(conn, "/api/pleroma/delete_account") + assert json_response(conn, 403) == %{"error" => "Invalid credentials."} + end + + test "with credentials and invalid password", %{conn: conn, user: current_user} do + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> post("/api/pleroma/delete_account", %{"password" => "hi"}) + + assert json_response(conn, 200) == %{"error" => "Invalid password."} + end + + test "with credentials and valid password", %{conn: conn, user: current_user} do + conn = + conn + |> with_credentials(current_user.nickname, "test") + |> post("/api/pleroma/delete_account", %{"password" => "test"}) + + assert json_response(conn, 200) == %{"status" => "success"} + end + end end |