1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.User.SynchronizationWorkerTest do
10 Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
12 config = Pleroma.Config.get([:instance, :external_user_synchronization])
14 for_update = [enabled: true, interval: 1000]
16 Pleroma.Config.put([:instance, :external_user_synchronization], for_update)
19 Pleroma.Config.put([:instance, :external_user_synchronization], config)
25 test "sync follow counters" do
29 ap_id: "http://localhost:4001/users/masto_closed"
32 user2 = insert(:user, local: false, ap_id: "http://localhost:4001/users/fuser2")
34 {:ok, _} = Pleroma.User.SynchronizationWorker.start_link()
37 %{follower_count: followers, following_count: following} =
38 Pleroma.User.get_cached_user_info(user1)
40 assert followers == 437
41 assert following == 152
43 %{follower_count: followers, following_count: following} =
44 Pleroma.User.get_cached_user_info(user2)
46 assert followers == 527
47 assert following == 267