diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-04-08 16:29:20 +0700 | 
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-04-08 16:29:20 +0700 | 
| commit | a1a854646e96598473ed7a323e034cf1f88ca508 (patch) | |
| tree | 4a427437c7c444fdfd2bb99dc012a7008d9bb0fe /test/web/oauth | |
| parent | 1c2e4f88d1a707791818014f8bcdedd986c2fa75 (diff) | |
| parent | fb2040d06199f2f4190ff363da54d6fcfa87ff69 (diff) | |
| download | pleroma-a1a854646e96598473ed7a323e034cf1f88ca508.tar.gz pleroma-a1a854646e96598473ed7a323e034cf1f88ca508.zip | |
Merge branch 'develop' into use-jobs-in-webpush
Diffstat (limited to 'test/web/oauth')
| -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 a9a0b9ed4..a68528420 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/web/oauth/oauth_controller_test.exs @@ -327,6 +327,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) | 
