diff options
| author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-11-12 18:36:50 +0700 | 
|---|---|---|
| committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-11-12 18:45:28 +0700 | 
| commit | e6d7e27bd603806e96dfc2774f90cadb3cf73a8c (patch) | |
| tree | 96b9c5de9bc8c43ee3bcd1e449bb19cec950a6e6 /test/web | |
| parent | 61fc739ab8917ccb5a12d6ab6db6130dc231990b (diff) | |
| download | pleroma-e6d7e27bd603806e96dfc2774f90cadb3cf73a8c.tar.gz pleroma-e6d7e27bd603806e96dfc2774f90cadb3cf73a8c.zip  | |
Add `allow_following_move` setting to User
Diffstat (limited to 'test/web')
3 files changed, 22 insertions, 1 deletions
diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/web/activity_pub/activity_pub_test.exs index 3f79593e5..6c5e5d38e 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/web/activity_pub/activity_pub_test.exs @@ -1428,10 +1428,13 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        %{ap_id: old_ap_id} = old_user = insert(:user)        %{ap_id: new_ap_id} = new_user = insert(:user, also_known_as: [old_ap_id])        follower = insert(:user) +      follower_move_opted_out = insert(:user, allow_following_move: false)        User.follow(follower, old_user) +      User.follow(follower_move_opted_out, old_user)        assert User.following?(follower, old_user) +      assert User.following?(follower_move_opted_out, old_user)        assert {:ok, activity} = ActivityPub.move(old_user, new_user) @@ -1458,6 +1461,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do        refute User.following?(follower, old_user)        assert User.following?(follower, new_user) + +      assert User.following?(follower_move_opted_out, old_user) +      refute User.following?(follower_move_opted_out, new_user)      end      test "old user must be in the new user's `also_known_as` list" do diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs index 519b56d6c..77cfce4fa 100644 --- a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs +++ b/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs @@ -103,6 +103,21 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do        assert user["locked"] == true      end +    test "updates the user's allow_following_move", %{conn: conn} do +      user = insert(:user) + +      assert user.allow_following_move == true + +      conn = +        conn +        |> assign(:user, user) +        |> patch("/api/v1/accounts/update_credentials", %{allow_following_move: "false"}) + +      assert refresh_record(user).allow_following_move == false +      assert user = json_response(conn, 200) +      assert user["pleroma"]["allow_following_move"] == false +    end +      test "updates the user's default scope", %{conn: conn} do        user = insert(:user) diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/web/mastodon_api/views/account_view_test.exs index af88841ed..3aa5d2e3b 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@ -102,7 +102,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do      privacy = user.default_scope      assert %{ -             pleroma: %{notification_settings: ^notification_settings}, +             pleroma: %{notification_settings: ^notification_settings, allow_following_move: true},               source: %{privacy: ^privacy}             } = AccountView.render("show.json", %{user: user, for: user})    end  | 
