logo

pleroma

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

welcome_message_test.exs (1056B)


  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.User.WelcomeMessageTest do
  5. use Pleroma.DataCase
  6. alias Pleroma.Config
  7. alias Pleroma.User.WelcomeMessage
  8. import Pleroma.Factory
  9. setup do: clear_config([:welcome])
  10. describe "post_message/1" do
  11. test "send a direct welcome message" do
  12. welcome_user = insert(:user)
  13. user = insert(:user, name: "Jimm")
  14. Config.put([:welcome, :direct_message, :enabled], true)
  15. Config.put([:welcome, :direct_message, :sender_nickname], welcome_user.nickname)
  16. Config.put(
  17. [:welcome, :direct_message, :message],
  18. "Hello. Welcome to Pleroma"
  19. )
  20. {:ok, %Pleroma.Activity{} = activity} = WelcomeMessage.post_message(user)
  21. assert user.ap_id in activity.recipients
  22. assert activity.data["directMessage"] == true
  23. assert Pleroma.Object.normalize(activity).data["content"] =~ "Hello. Welcome to Pleroma"
  24. end
  25. end
  26. end