From f226f46a097b6b87a87ce1ead07383e8f83ad8ea Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Tue, 1 Aug 2017 17:05:07 +0200 Subject: Add basic incoming deletions. --- test/fixtures/delete.xml | 39 ++++++++++++++++++++++ .../incoming_documents/delete_handling_test.exs | 23 +++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 test/fixtures/delete.xml create mode 100644 test/web/ostatus/incoming_documents/delete_handling_test.exs (limited to 'test') diff --git a/test/fixtures/delete.xml b/test/fixtures/delete.xml new file mode 100644 index 000000000..731e1c204 --- /dev/null +++ b/test/fixtures/delete.xml @@ -0,0 +1,39 @@ + + + https://mastodon.sdf.org/users/snowdusk.atom + snowdusk + Amateur live performance DJ/radio DJ on SDF's underground Internet radio http://aNONradio.net (LIVE Sat Sun Mon Tue 23:00-24:00 UTC) - http://snowdusk.sdf.org + 2017-06-17T04:14:34Z + https://mastodon.sdf.org/system/accounts/avatars/000/000/002/original/405a7652d5f60449.jpg?1497672873 + + https://mastodon.sdf.org/users/snowdusk + http://activitystrea.ms/schema/1.0/person + https://mastodon.sdf.org/users/snowdusk + snowdusk + snowdusk@mastodon.sdf.org + <p>Amateur live performance DJ/radio DJ on SDF&apos;s underground Internet radio <a href="http://anonradio.net/" rel="nofollow noopener" target="_blank"><span class="invisible">http://</span><span class="">anonradio.net/</span><span class="invisible"></span></a> (LIVE Sat Sun Mon Tue 23:00-24:00 UTC) - <a href="http://snowdusk.sdf.org/" rel="nofollow noopener" target="_blank"><span class="invisible">http://</span><span class="">snowdusk.sdf.org/</span><span class="invisible"></span></a></p> + + + + snowdusk + snowdusk + Amateur live performance DJ/radio DJ on SDF's underground Internet radio http://aNONradio.net (LIVE Sat Sun Mon Tue 23:00-24:00 UTC) - http://snowdusk.sdf.org + public + + + + + + + + tag:mastodon.sdf.org,2017-06-10:objectId=310513:objectType=Status + 2017-06-10T22:02:31Z + 2017-06-10T22:02:31Z + snowdusk deleted status + http://activitystrea.ms/schema/1.0/activity + http://activitystrea.ms/schema/1.0/delete + Deleted status + + + + diff --git a/test/web/ostatus/incoming_documents/delete_handling_test.exs b/test/web/ostatus/incoming_documents/delete_handling_test.exs new file mode 100644 index 000000000..8cd6e295e --- /dev/null +++ b/test/web/ostatus/incoming_documents/delete_handling_test.exs @@ -0,0 +1,23 @@ +defmodule Pleroma.Web.OStatus.DeleteHandlingTest do + use Pleroma.DataCase + + import Pleroma.Factory + alias Pleroma.{Repo, Activity, Object} + alias Pleroma.Web.OStatus + + describe "deletions" do + test "it removes the mentioned activity" do + note = insert(:note_activity) + second_note = insert(:note_activity) + + incoming = File.read!("test/fixtures/delete.xml") + |> String.replace("tag:mastodon.sdf.org,2017-06-10:objectId=310513:objectType=Status", note.data["object"]["id"]) + {:ok, []} = OStatus.handle_incoming(incoming) + + refute Repo.get(Activity, note.id) + refute Object.get_by_ap_id(note.data["object"]["id"]) + assert Repo.get(Activity, second_note.id) + assert Object.get_by_ap_id(second_note.data["object"]["id"]) + end + end +end -- cgit v1.2.3