1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.FollowingRelationshipTest do
6 use Pleroma.DataCase, async: true
8 alias Pleroma.FollowingRelationship
9 alias Pleroma.Web.ActivityPub.InternalFetchActor
10 alias Pleroma.Web.ActivityPub.Relay
12 import Pleroma.Factory
14 describe "following/1" do
15 test "returns following addresses without internal.fetch" do
17 fetch_actor = InternalFetchActor.get_actor()
18 FollowingRelationship.follow(fetch_actor, user, :follow_accept)
19 assert FollowingRelationship.following(fetch_actor) == [user.follower_address]
22 test "returns following addresses without relay" do
24 relay_actor = Relay.get_actor()
25 FollowingRelationship.follow(relay_actor, user, :follow_accept)
26 assert FollowingRelationship.following(relay_actor) == [user.follower_address]
29 test "returns following addresses without remote user" do
31 actor = insert(:user, local: false)
32 FollowingRelationship.follow(actor, user, :follow_accept)
33 assert FollowingRelationship.following(actor) == [user.follower_address]
36 test "returns following addresses with local user" do
38 actor = insert(:user, local: true)
39 FollowingRelationship.follow(actor, user, :follow_accept)
41 assert FollowingRelationship.following(actor) == [
42 actor.follower_address,