logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

follow_validation_test.exs (1270B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Web.ActivityPub.ObjectValidators.FollowValidationTest do
  5. use Pleroma.DataCase, async: true
  6. alias Pleroma.Web.ActivityPub.Builder
  7. alias Pleroma.Web.ActivityPub.ObjectValidator
  8. import Pleroma.Factory
  9. describe "Follows" do
  10. setup do
  11. follower = insert(:user)
  12. followed = insert(:user)
  13. {:ok, valid_follow, []} = Builder.follow(follower, followed)
  14. %{follower: follower, followed: followed, valid_follow: valid_follow}
  15. end
  16. test "validates a basic follow object", %{valid_follow: valid_follow} do
  17. assert {:ok, _follow, []} = ObjectValidator.validate(valid_follow, [])
  18. end
  19. test "supports a nil cc", %{valid_follow: valid_follow} do
  20. valid_follow_with_nil_cc = Map.put(valid_follow, "cc", nil)
  21. assert {:ok, _follow, []} = ObjectValidator.validate(valid_follow_with_nil_cc, [])
  22. end
  23. test "supports an empty cc", %{valid_follow: valid_follow} do
  24. valid_follow_with_empty_cc = Map.put(valid_follow, "cc", [])
  25. assert {:ok, _follow, []} = ObjectValidator.validate(valid_follow_with_empty_cc, [])
  26. end
  27. end
  28. end