1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.User.WelcomeMessageTest do
9 alias Pleroma.User.WelcomeMessage
11 import Pleroma.Factory
13 setup do: clear_config([:welcome])
15 describe "post_message/1" do
16 test "send a direct welcome message" do
17 welcome_user = insert(:user)
18 user = insert(:user, name: "Jimm")
20 Config.put([:welcome, :direct_message, :enabled], true)
21 Config.put([:welcome, :direct_message, :sender_nickname], welcome_user.nickname)
24 [:welcome, :direct_message, :message],
25 "Hello. Welcome to Pleroma"
28 {:ok, %Pleroma.Activity{} = activity} = WelcomeMessage.post_message(user)
29 assert user.ap_id in activity.recipients
30 assert activity.data["directMessage"] == true
32 assert Pleroma.Object.normalize(activity, fetch: false).data["content"] =~
33 "Hello. Welcome to Pleroma"