diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-01-31 15:07:49 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-01-31 15:07:49 +0700 |
commit | d3677d2b4d4d53619777509e0169bb0764213d39 (patch) | |
tree | c93f81bd476ba1feee727dd16d72593968aa3648 /test/web/oauth/oauth_controller_test.exs | |
parent | ab31adf15bbec1597a9b7cf065898fb3f712eef3 (diff) | |
parent | 95d6118090fbd36fca4fd62133b270eaf27ae4df (diff) | |
download | pleroma-d3677d2b4d4d53619777509e0169bb0764213d39.tar.gz pleroma-d3677d2b4d4d53619777509e0169bb0764213d39.zip |
Merge remote-tracking branch 'MAIN/develop' into feature/jobs
Diffstat (limited to 'test/web/oauth/oauth_controller_test.exs')
-rw-r--r-- | test/web/oauth/oauth_controller_test.exs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/web/oauth/oauth_controller_test.exs b/test/web/oauth/oauth_controller_test.exs index ccd552258..e0d3cb55f 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -34,6 +34,31 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do assert Repo.get_by(Authorization, token: code) end + test "correctly handles wrong credentials", %{conn: conn} do + user = insert(:user) + app = insert(:oauth_app) + + result = + conn + |> post("/oauth/authorize", %{ + "authorization" => %{ + "name" => user.nickname, + "password" => "wrong", + "client_id" => app.client_id, + "redirect_uri" => app.redirect_uris, + "state" => "statepassed" + } + }) + |> html_response(:unauthorized) + + # Keep the details + assert result =~ app.client_id + assert result =~ app.redirect_uris + + # Error message + assert result =~ "Invalid" + end + test "issues a token for an all-body request" do user = insert(:user) app = insert(:oauth_app) |