Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
923B

  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. defmodule Pleroma.ActivityTest do
  5. use Pleroma.DataCase
  6. alias Pleroma.Activity
  7. import Pleroma.Factory
  8. test "returns an activity by it's AP id" do
  9. activity = insert(:note_activity)
  10. found_activity = Activity.get_by_ap_id(activity.data["id"])
  11. assert activity == found_activity
  12. end
  13. test "returns activities by it's objects AP ids" do
  14. activity = insert(:note_activity)
  15. [found_activity] = Activity.all_by_object_ap_id(activity.data["object"]["id"])
  16. assert activity == found_activity
  17. end
  18. test "returns the activity that created an object" do
  19. activity = insert(:note_activity)
  20. found_activity = Activity.get_create_activity_by_object_ap_id(activity.data["object"]["id"])
  21. assert activity == found_activity
  22. end
  23. end