logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma

following_relationship_test.exs (1644B)


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