diff options
Diffstat (limited to 'test/user/synchronization_test.exs')
-rw-r--r-- | test/user/synchronization_test.exs | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/test/user/synchronization_test.exs b/test/user/synchronization_test.exs deleted file mode 100644 index 67b669431..000000000 --- a/test/user/synchronization_test.exs +++ /dev/null @@ -1,104 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.User.SynchronizationTest do - use Pleroma.DataCase - import Pleroma.Factory - alias Pleroma.User - alias Pleroma.User.Synchronization - - setup do - Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end) - :ok - end - - test "update following/followers counters" do - user1 = - insert(:user, - local: false, - ap_id: "http://localhost:4001/users/masto_closed" - ) - - user2 = insert(:user, local: false, ap_id: "http://localhost:4001/users/fuser2") - - users = User.external_users() - assert length(users) == 2 - {user, %{}} = Synchronization.call(users, %{}) - assert user == List.last(users) - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user1) - assert followers == 437 - assert following == 152 - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user2) - - assert followers == 527 - assert following == 267 - end - - test "don't check host if errors exist" do - user1 = insert(:user, local: false, ap_id: "http://domain-with-errors:4001/users/fuser1") - - user2 = insert(:user, local: false, ap_id: "http://domain-with-errors:4001/users/fuser2") - - users = User.external_users() - assert length(users) == 2 - - {user, %{"domain-with-errors" => 2}} = - Synchronization.call(users, %{"domain-with-errors" => 2}, max_retries: 2) - - assert user == List.last(users) - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user1) - assert followers == 0 - assert following == 0 - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user2) - - assert followers == 0 - assert following == 0 - end - - test "don't check host if errors appeared" do - user1 = insert(:user, local: false, ap_id: "http://domain-with-errors:4001/users/fuser1") - - user2 = insert(:user, local: false, ap_id: "http://domain-with-errors:4001/users/fuser2") - - users = User.external_users() - assert length(users) == 2 - - {user, %{"domain-with-errors" => 2}} = Synchronization.call(users, %{}, max_retries: 2) - - assert user == List.last(users) - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user1) - assert followers == 0 - assert following == 0 - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user2) - - assert followers == 0 - assert following == 0 - end - - test "other users after error appeared" do - user1 = insert(:user, local: false, ap_id: "http://domain-with-errors:4001/users/fuser1") - user2 = insert(:user, local: false, ap_id: "http://localhost:4001/users/fuser2") - - users = User.external_users() - assert length(users) == 2 - - {user, %{"domain-with-errors" => 2}} = Synchronization.call(users, %{}, max_retries: 2) - assert user == List.last(users) - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user1) - assert followers == 0 - assert following == 0 - - %{follower_count: followers, following_count: following} = User.get_cached_user_info(user2) - - assert followers == 527 - assert following == 267 - end -end |