SideEffects test: Add test for favorite deletion.
This commit is contained in:
parent
79cd723a1e
commit
679afb2de4
|
@ -27,12 +27,22 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
|
||||||
|
|
||||||
{:ok, op} = CommonAPI.post(other_user, %{"status" => "big oof"})
|
{:ok, op} = CommonAPI.post(other_user, %{"status" => "big oof"})
|
||||||
{:ok, post} = CommonAPI.post(user, %{"status" => "hey", "in_reply_to_id" => op})
|
{:ok, post} = CommonAPI.post(user, %{"status" => "hey", "in_reply_to_id" => op})
|
||||||
|
{:ok, favorite} = CommonAPI.favorite(user, post.id)
|
||||||
object = Object.normalize(post)
|
object = Object.normalize(post)
|
||||||
{:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
|
{:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
|
||||||
{:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id)
|
{:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id)
|
||||||
{:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
|
{:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
|
||||||
{:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true)
|
{:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true)
|
||||||
%{user: user, delete: delete, post: post, object: object, delete_user: delete_user, op: op}
|
|
||||||
|
%{
|
||||||
|
user: user,
|
||||||
|
delete: delete,
|
||||||
|
post: post,
|
||||||
|
object: object,
|
||||||
|
delete_user: delete_user,
|
||||||
|
op: op,
|
||||||
|
favorite: favorite
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it handles object deletions", %{
|
test "it handles object deletions", %{
|
||||||
|
@ -40,7 +50,8 @@ test "it handles object deletions", %{
|
||||||
post: post,
|
post: post,
|
||||||
object: object,
|
object: object,
|
||||||
user: user,
|
user: user,
|
||||||
op: op
|
op: op,
|
||||||
|
favorite: favorite
|
||||||
} do
|
} do
|
||||||
with_mock Pleroma.Web.ActivityPub.ActivityPub, [:passthrough],
|
with_mock Pleroma.Web.ActivityPub.ActivityPub, [:passthrough],
|
||||||
stream_out: fn _ -> nil end,
|
stream_out: fn _ -> nil end,
|
||||||
|
@ -55,6 +66,7 @@ test "it handles object deletions", %{
|
||||||
object = Object.get_by_id(object.id)
|
object = Object.get_by_id(object.id)
|
||||||
assert object.data["type"] == "Tombstone"
|
assert object.data["type"] == "Tombstone"
|
||||||
refute Activity.get_by_id(post.id)
|
refute Activity.get_by_id(post.id)
|
||||||
|
refute Activity.get_by_id(favorite.id)
|
||||||
|
|
||||||
user = User.get_by_id(user.id)
|
user = User.get_by_id(user.id)
|
||||||
assert user.note_count == 0
|
assert user.note_count == 0
|
||||||
|
|
Loading…
Reference in New Issue