diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-05-02 21:31:01 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-05-02 21:31:01 +0200 |
commit | 018a1a390fdb72652c615c28ac36f1b9a6a84d82 (patch) | |
tree | 990b1da8159119290185066847f9b93d513dc6f0 /test/web | |
parent | 33c803d6da91e0253a100cbd480d253706c44964 (diff) | |
download | pleroma-018a1a390fdb72652c615c28ac36f1b9a6a84d82.tar.gz pleroma-018a1a390fdb72652c615c28ac36f1b9a6a84d82.zip |
Use inReplyTo to find context.
Diffstat (limited to 'test/web')
-rw-r--r-- | test/web/ostatus/ostatus_test.exs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs index 1674edbd5..e39952807 100644 --- a/test/web/ostatus/ostatus_test.exs +++ b/test/web/ostatus/ostatus_test.exs @@ -2,6 +2,7 @@ defmodule Pleroma.Web.OStatusTest do use Pleroma.DataCase alias Pleroma.Web.OStatus alias Pleroma.Web.XML + alias Pleroma.{Object, Repo} test "don't insert create notes twice" do incoming = File.read!("test/fixtures/incoming_note_activity.xml") @@ -32,6 +33,22 @@ defmodule Pleroma.Web.OStatusTest do assert activity.data["object"]["content"] == "Will it blend?" end + test "handle incoming notes - Mastodon, salmon, reply" do + # It uses the context of the replied to object + Repo.insert!(%Object{ + data: %{ + "id" => "https://pleroma.soykaf.com/objects/c237d966-ac75-4fe3-a87a-d89d71a3a7a4", + "context" => "2hu" + }}) + incoming = File.read!("test/fixtures/incoming_reply_mastodon.xml") + {:ok, [activity]} = OStatus.handle_incoming(incoming) + + assert activity.data["type"] == "Create" + assert activity.data["object"]["type"] == "Note" + assert activity.data["object"]["actor"] == "https://mastodon.social/users/lambadalambda" + assert activity.data["context"] == "2hu" + end + test "handle incoming notes - GS, subscription, reply" do incoming = File.read!("test/fixtures/ostatus_incoming_reply.xml") {:ok, [activity]} = OStatus.handle_incoming(incoming) |