X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Fostatus%2Factivity_representer_test.exs;h=969b2a854cf193f5880b83b189ad5240045f2662;hb=b403ea4d2b69cef4434ad68babdfb402d8227847;hp=af936b57c59f8e5a66406b45976672dc684e4beb;hpb=60b4b0d725aefdca3eedd2d7708b0c96ee60c5f4;p=akkoma diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs index af936b57c..969b2a854 100644 --- a/test/web/ostatus/activity_representer_test.exs +++ b/test/web/ostatus/activity_representer_test.exs @@ -199,6 +199,44 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do assert clean(res) == clean(expected) end + test "an unfollow activity" do + follower = insert(:user) + followed = insert(:user) + {:ok, _activity} = ActivityPub.follow(follower, followed) + {:ok, activity} = ActivityPub.unfollow(follower, followed) + + # TODO: Are these the correct dates? + updated_at = activity.updated_at + |> NaiveDateTime.to_iso8601 + inserted_at = activity.inserted_at + |> NaiveDateTime.to_iso8601 + + tuple = ActivityRepresenter.to_simple_form(activity, follower) + + refute is_nil(tuple) + + res = :xmerl.export_simple_content(tuple, :xmerl_xml) |> IO.iodata_to_binary + + expected = """ + http://activitystrea.ms/schema/1.0/activity + http://activitystrea.ms/schema/1.0/unfollow + #{activity.data["id"]} + #{follower.nickname} stopped following #{followed.ap_id} + #{follower.nickname} stopped following #{followed.ap_id} + #{inserted_at} + #{updated_at} + + http://activitystrea.ms/schema/1.0/person + #{followed.ap_id} + #{followed.ap_id} + + + + """ + + assert clean(res) == clean(expected) + end + test "an unknown activity" do tuple = ActivityRepresenter.to_simple_form(%Activity{}, nil) assert is_nil(tuple)