diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-14 16:26:56 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-14 21:29:14 +0300 |
commit | c9f45edeac2cc3ed262bb4b30dc7e1120c6fa047 (patch) | |
tree | 3ba35681409d9c5dd9ca4d355ff39d4dd67448d4 /test/support/conn_case.ex | |
parent | 969769730e0b7578ddc6a5cd02f9b24eff5902a0 (diff) | |
parent | 12b28c8925c2c55e0d7bb66ff3320532a1aade3b (diff) | |
download | pleroma-c9f45edeac2cc3ed262bb4b30dc7e1120c6fa047.tar.gz |
Merge branch 'develop' into feature/tag_feed
Diffstat (limited to 'test/support/conn_case.ex')
-rw-r--r-- | test/support/conn_case.ex | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 9897f72ce..22e72fc09 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -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 = + Keyword.get_lazy(opts, :user, fn -> + Pleroma.Factory.insert(:user) + end) + + token = + Keyword.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 |