From beb7b0ef07f880b6eecc01d04980b38ba8521a81 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 18 May 2017 15:58:18 +0200 Subject: Handle incoming tags. --- test/fixtures/ostatus_incoming_post_tag.xml | 58 +++++++++++++++++++++++++++++ test/web/ostatus/ostatus_test.exs | 7 ++++ 2 files changed, 65 insertions(+) create mode 100644 test/fixtures/ostatus_incoming_post_tag.xml (limited to 'test') diff --git a/test/fixtures/ostatus_incoming_post_tag.xml b/test/fixtures/ostatus_incoming_post_tag.xml new file mode 100644 index 000000000..695766d73 --- /dev/null +++ b/test/fixtures/ostatus_incoming_post_tag.xml @@ -0,0 +1,58 @@ + + + GNU social + https://social.heldscal.la/api/statuses/user_timeline/23211.atom + lambadalambda timeline + Updates from lambadalambda on social.heldscal.la! + https://social.heldscal.la/avatar/23211-96-20170416114255.jpeg + 2017-04-29T18:25:38+00:00 + + http://activitystrea.ms/schema/1.0/person + https://social.heldscal.la/user/23211 + lambadalambda + Call me Deacon Blues. + + + + + + lambadalambda + Constance Variable + Call me Deacon Blues. + + Berlin + + + homepage + https://heldscal.la + true + + + + + + + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.heldscal.la,2017-04-29:noticeId=1967725:objectType=note + New note by lambadalambda + Will it blend? + + + + http://activitystrea.ms/schema/1.0/post + 2017-04-29T18:25:38+00:00 + 2017-04-29T18:25:38+00:00 + + tag:social.heldscal.la,2017-04-29:objectType=thread:nonce=3f3a9dd83acc4e35 + + + + + + diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs index e38a195d9..6599b00b3 100644 --- a/test/web/ostatus/ostatus_test.exs +++ b/test/web/ostatus/ostatus_test.exs @@ -46,6 +46,13 @@ defmodule Pleroma.Web.OStatusTest do assert activity.data["object"]["attachment"] |> length == 2 end + test "handle incoming notes with tags" do + incoming = File.read!("test/fixtures/ostatus_incoming_post_tag.xml") + {:ok, [activity]} = OStatus.handle_incoming(incoming) + + assert activity.data["object"]["tag"] == ["nsfw"] + end + test "handle incoming notes - Mastodon, salmon, reply" do # It uses the context of the replied to object Repo.insert!(%Object{ -- cgit v1.2.3