OAuthScopesPlug: disallowed nil token (unless with :fallback option). WIP: controller tests modification: OAuth scopes usage.
This commit is contained in:
parent
8efacfed67
commit
7973cbdb9f
14 changed files with 638 additions and 912 deletions
|
|
@ -28,6 +28,26 @@ defmodule Pleroma.Web.ConnCase do
|
|||
|
||||
# The default endpoint for testing
|
||||
@endpoint Pleroma.Web.Endpoint
|
||||
|
||||
# Sets up OAuth access with specified scopes
|
||||
defp oauth_access(scopes, opts \\ %{}) do
|
||||
user =
|
||||
Map.get_lazy(opts, :user, fn ->
|
||||
Pleroma.Factory.insert(:user)
|
||||
end)
|
||||
|
||||
token =
|
||||
Map.get_lazy(opts, :oauth_token, fn ->
|
||||
Pleroma.Factory.insert(:oauth_token, user: user, scopes: scopes)
|
||||
end)
|
||||
|
||||
conn =
|
||||
build_conn()
|
||||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|
||||
%{user: user, token: token, conn: conn}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue