Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / test / daemons / scheduled_activity_daemon_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.ScheduledActivityDaemonTest do
6 use Pleroma.DataCase
7 alias Pleroma.ScheduledActivity
8 import Pleroma.Factory
9
10 test "creates a status from the scheduled activity" do
11 user = insert(:user)
12 scheduled_activity = insert(:scheduled_activity, user: user, params: %{status: "hi"})
13 Pleroma.Daemons.ScheduledActivityDaemon.perform(:execute, scheduled_activity.id)
14
15 refute Repo.get(ScheduledActivity, scheduled_activity.id)
16 activity = Repo.all(Pleroma.Activity) |> Enum.find(&(&1.actor == user.ap_id))
17 assert Pleroma.Object.normalize(activity).data["content"] == "hi"
18 end
19 end