diff options
author | Ivan Tashkinov <ivant.business@gmail.com> | 2019-04-08 12:20:26 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivant.business@gmail.com> | 2019-04-08 12:20:26 +0300 |
commit | bffddf5e31c53d0603de387c61b6011f70785b97 (patch) | |
tree | 97f07fb95346b603307534a34d0ecee5c9b70af1 /test/web/oauth/oauth_controller_test.exs | |
parent | e3328bc1382315c9067c099995a29db70d9d0433 (diff) | |
parent | b177e1e7f330ff1531be190949db7f75e378a449 (diff) | |
download | pleroma-bffddf5e31c53d0603de387c61b6011f70785b97.tar.gz |
[#923] Merge remote-tracking branch 'remotes/upstream/develop' into twitter_oauth
# Conflicts:
# docs/config.md
# test/support/factory.ex
Diffstat (limited to 'test/web/oauth/oauth_controller_test.exs')
-rw-r--r-- | test/web/oauth/oauth_controller_test.exs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs index 385896dc6..ac7843f9b 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -633,6 +633,32 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do refute Map.has_key?(resp, "access_token") end + test "rejects token exchange for valid credentials belonging to deactivated user" do + password = "testpassword" + + user = + insert(:user, + password_hash: Comeonin.Pbkdf2.hashpwsalt(password), + info: %{deactivated: true} + ) + + app = insert(:oauth_app) + + conn = + build_conn() + |> post("/oauth/token", %{ + "grant_type" => "password", + "username" => user.nickname, + "password" => password, + "client_id" => app.client_id, + "client_secret" => app.client_secret + }) + + assert resp = json_response(conn, 403) + assert %{"error" => _} = resp + refute Map.has_key?(resp, "access_token") + end + test "rejects an invalid authorization code" do app = insert(:oauth_app) |