change Repo.get(Activity, id) => Activity.get_by_id(id) in tests

This commit is contained in:
Egor Kislitsyn 2019-04-02 17:08:03 +07:00
commit 11c2d6bdc4
10 changed files with 32 additions and 33 deletions

View file

@ -116,10 +116,10 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
{:ok, announce, _object} = ActivityPub.announce(user, object)
announce = Repo.get(Activity, announce.id)
announce = Activity.get_by_id(announce.id)
note_user = User.get_cached_by_ap_id(note.data["actor"])
note = Repo.get(Activity, note.id)
note = Activity.get_by_id(note.id)
note_xml =
ActivityRepresenter.to_simple_form(note, note_user, true)

View file

@ -6,7 +6,6 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
alias Pleroma.Activity
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.Web.OStatus
setup do
@ -32,10 +31,10 @@ defmodule Pleroma.Web.OStatus.DeleteHandlingTest do
{:ok, [delete]} = OStatus.handle_incoming(incoming)
refute Repo.get(Activity, note.id)
refute Repo.get(Activity, like.id)
refute Activity.get_by_id(note.id)
refute Activity.get_by_id(like.id)
assert Object.get_by_ap_id(note.data["object"]["id"]).data["type"] == "Tombstone"
assert Repo.get(Activity, second_note.id)
assert Activity.get_by_id(second_note.id)
assert Object.get_by_ap_id(second_note.data["object"]["id"])
assert delete.data["type"] == "Delete"

View file

@ -154,7 +154,7 @@ defmodule Pleroma.Web.OStatusTest do
assert "https://pleroma.soykaf.com/users/lain" in activity.data["to"]
refute activity.local
retweeted_activity = Repo.get(Activity, retweeted_activity.id)
retweeted_activity = Activity.get_by_id(retweeted_activity.id)
assert retweeted_activity.data["type"] == "Create"
assert retweeted_activity.data["actor"] == "https://pleroma.soykaf.com/users/lain"
refute retweeted_activity.local
@ -181,7 +181,7 @@ defmodule Pleroma.Web.OStatusTest do
assert user.ap_id in activity.data["to"]
refute activity.local
retweeted_activity = Repo.get(Activity, retweeted_activity.id)
retweeted_activity = Activity.get_by_id(retweeted_activity.id)
assert note_activity.id == retweeted_activity.id
assert retweeted_activity.data["type"] == "Create"
assert retweeted_activity.data["actor"] == user.ap_id