X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fmasto_fe_controller_test.exs;h=f3b54b5f2cb36ec163c17ad7df93bdb62a77d7fb;hb=9c672ecbb5d4477cd16d2139a2cb66d3923ac5c8;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..f3b54b5f2 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.mastofe_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