diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-09-04 17:56:09 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-09-04 17:56:09 +0200 |
commit | 540dfb4617aaab400d0aeafa47d41544c00a2b83 (patch) | |
tree | 74eafc189423290df1b93ba2f2621f1297928f53 /test | |
parent | 10e40206c6890cc1d88a391ab620ef859ed71521 (diff) | |
download | pleroma-540dfb4617aaab400d0aeafa47d41544c00a2b83.tar.gz pleroma-540dfb4617aaab400d0aeafa47d41544c00a2b83.zip |
Add delete activity representer.
Diffstat (limited to 'test')
-rw-r--r-- | test/web/ostatus/activity_representer_test.exs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs index 47eecb247..bcf569395 100644 --- a/test/web/ostatus/activity_representer_test.exs +++ b/test/web/ostatus/activity_representer_test.exs @@ -225,6 +225,29 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do assert clean(res) == clean(expected) end + test "a delete" do + user = insert(:user) + activity = %Activity{data: %{ "id" => "ap_id", "type" => "Delete", "actor" => user.ap_id, "object" => "some_id", "published" => "2017-06-18T12:00:18+00:00" }} + + tuple = ActivityRepresenter.to_simple_form(activity, nil) + + refute is_nil(tuple) + + res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> IO.iodata_to_binary + + expected = """ + <activity:object-type>http://activitystrea.ms/schema/1.0/activity</activity:object-type> + <activity:verb>http://activitystrea.ms/schema/1.0/delete</activity:verb> + <id>#{activity.data["object"]}</id> + <title>An object was deleted</title> + <content type="html">An object was deleted</content> + <published>#{activity.data["published"]}</published> + <updated>#{activity.data["published"]}</updated> + """ + + assert clean(res) == clean(expected) + end + test "an unknown activity" do tuple = ActivityRepresenter.to_simple_form(%Activity{}, nil) assert is_nil(tuple) |