X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Ftwitter_api%2Futil_controller_test.exs;h=734cd221199554898ef40bbec79c0b658a4b139a;hb=3ecf131511afc1fc366be6402ca94cf0e6c30e11;hp=9d4cb70f0677a2498b90d42fb369acb4687da78f;hpb=73b6512907d205d4be49864541eeb941d259aa57;p=akkoma diff --git a/test/web/twitter_api/util_controller_test.exs b/test/web/twitter_api/util_controller_test.exs index 9d4cb70f0..734cd2211 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/web/twitter_api/util_controller_test.exs @@ -159,12 +159,32 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do user = Repo.get(User, user.id) - assert %{ - "followers" => false, - "follows" => true, - "non_follows" => true, - "non_followers" => true - } == user.info.notification_settings + assert %Pleroma.User.NotificationSetting{ + followers: false, + follows: true, + non_follows: true, + non_followers: true, + privacy_option: false + } == user.notification_settings + end + + test "it update notificatin privacy option", %{conn: conn} do + user = insert(:user) + + conn + |> assign(:user, user) + |> put("/api/pleroma/notification_settings", %{"privacy_option" => "1"}) + |> json_response(:ok) + + user = refresh_record(user) + + assert %Pleroma.User.NotificationSetting{ + followers: true, + follows: true, + non_follows: true, + non_followers: true, + privacy_option: true + } == user.notification_settings end end @@ -366,11 +386,11 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do |> response(200) assert response =~ "Account followed!" - assert user2.follower_address in refresh_record(user).following + assert user2.follower_address in User.following(user) end test "returns error when user is deactivated", %{conn: conn} do - user = insert(:user, info: %{deactivated: true}) + user = insert(:user, deactivated: true) user2 = insert(:user) response = @@ -387,7 +407,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do user = insert(:user) user2 = insert(:user) - {:ok, _user} = Pleroma.User.block(user2, user) + {:ok, _user_block} = Pleroma.User.block(user2, user) response = conn @@ -438,7 +458,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do |> response(200) assert response =~ "Account followed!" - assert user2.follower_address in refresh_record(user).following + assert user2.follower_address in User.following(user) end test "returns error when followee not found", %{conn: conn} do @@ -485,7 +505,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do Pleroma.Config.put([:user, :deny_follow_blocked], true) user = insert(:user) user2 = insert(:user) - {:ok, _user} = Pleroma.User.block(user2, user) + {:ok, _user_block} = Pleroma.User.block(user2, user) response = conn @@ -568,7 +588,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do user = User.get_cached_by_id(user.id) - assert user.info.deactivated == true + assert user.deactivated == true end test "it returns returns when password invalid", %{conn: conn} do @@ -583,7 +603,7 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do assert response == %{"error" => "Invalid password."} user = User.get_cached_by_id(user.id) - refute user.info.deactivated + refute user.deactivated end end