summaryrefslogtreecommitdiff
path: root/test/web/oauth/oauth_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-01-28 15:39:14 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-01-28 15:39:14 +0300
commitd3f9e6f6fed382ede8e314c370c21e84a119f65a (patch)
treec8cd63007993d25bb8c17b5b83e8761db9de3295 /test/web/oauth/oauth_controller_test.exs
parent1d2f41642cfec5710055bcf8409778bb362beecb (diff)
parentde0fb88a9cf587b9613e267d5dddfe55b0f414b7 (diff)
downloadpleroma-d3f9e6f6fed382ede8e314c370c21e84a119f65a.tar.gz
pleroma-d3f9e6f6fed382ede8e314c370c21e84a119f65a.zip
[#534] Merged `upstream/develop`.
Diffstat (limited to 'test/web/oauth/oauth_controller_test.exs')
-rw-r--r--test/web/oauth/oauth_controller_test.exs25
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)