Merge branch 'carrot-bullying' into 'develop'
[akkoma] / test / activity_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.ActivityTest do
6 use Pleroma.DataCase
7 alias Pleroma.Activity
8 import Pleroma.Factory
9
10 test "returns an activity by it's AP id" do
11 activity = insert(:note_activity)
12 found_activity = Activity.get_by_ap_id(activity.data["id"])
13
14 assert activity == found_activity
15 end
16
17 test "returns activities by it's objects AP ids" do
18 activity = insert(:note_activity)
19 [found_activity] = Activity.all_by_object_ap_id(activity.data["object"]["id"])
20
21 assert activity == found_activity
22 end
23
24 test "returns the activity that created an object" do
25 activity = insert(:note_activity)
26
27 found_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"]["id"])
28
29 assert activity == found_activity
30 end
31 end