X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmasto_fe_controller_test.exs;h=1d107d56c0087bab1f910a7af684593437447d5d;hb=3a45952a3a324e5fb823e9bdf3ffe19fb3923cb3;hp=04f1440490dce8bfe86d2bce0b7167ff73c005e8;hpb=d3c404af124c7083b1f23466b9e82df5d2a407d0;p=akkoma
diff --git a/test/web/masto_fe_controller_test.exs b/test/web/masto_fe_controller_test.exs
index 04f144049..1d107d56c 100644
--- a/test/web/masto_fe_controller_test.exs
+++ b/test/web/masto_fe_controller_test.exs
@@ -1,15 +1,16 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.MastoFEController do
use Pleroma.Web.ConnCase
- alias Pleroma.User
alias Pleroma.Config
+ alias Pleroma.User
+
import Pleroma.Factory
- clear_config([:instance, :public])
+ setup do: clear_config([:instance, :public])
test "put settings", %{conn: conn} do
user = insert(:user)
@@ -17,12 +18,13 @@ defmodule Pleroma.Web.MastodonAPI.MastoFEController do
conn =
conn
|> assign(:user, user)
+ |> assign(:token, insert(:oauth_token, user: user, scopes: ["write:accounts"]))
|> put("/api/web/settings", %{"data" => %{"programming" => "socks"}})
assert _result = json_response(conn, 200)
user = User.get_cached_by_ap_id(user.ap_id)
- assert user.info.settings == %{"programming" => "socks"}
+ assert user.settings == %{"programming" => "socks"}
end
describe "index/2 redirections" do
@@ -62,12 +64,12 @@ defmodule Pleroma.Web.MastodonAPI.MastoFEController do
end
test "does not redirect logged in users to the login page", %{conn: conn, path: path} do
- token = insert(:oauth_token)
+ token = insert(:oauth_token, scopes: ["read"])
conn =
conn
|> assign(:user, token.user)
- |> put_session(:oauth_token, token.token)
+ |> assign(:token, token)
|> get(path)
assert conn.status == 200