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.User.WelcomeMessageTest do
8 alias Pleroma.User.WelcomeMessage
10 import Pleroma.Factory
12 setup do: clear_config([:welcome])
14 describe "post_message/1" do
15 test "send a direct welcome message" do
16 welcome_user = insert(:user)
17 user = insert(:user, name: "Jimm")
19 clear_config([:welcome, :direct_message, :enabled], true)
20 clear_config([:welcome, :direct_message, :sender_nickname], welcome_user.nickname)
23 [:welcome, :direct_message, :message],
24 "Hello. Welcome to Pleroma"
27 {:ok, %Pleroma.Activity{} = activity} = WelcomeMessage.post_message(user)
28 assert user.ap_id in activity.recipients
29 assert activity.data["directMessage"] == true
31 assert Pleroma.Object.normalize(activity, fetch: false).data["content"] =~
32 "Hello. Welcome to Pleroma"