summaryrefslogtreecommitdiff
path: root/test/web/ostatus
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2019-07-09 10:18:30 -0500
committerMark Felder <feld@FreeBSD.org>2019-07-09 10:18:30 -0500
commit31a59d6f23d66f0f4221d2f036e727f22da17615 (patch)
tree230fcd3e5a02433c8f14dd40e0217cfcad54b02c /test/web/ostatus
parent98f13eac9e38c6ec44a7146cfc58114b0148f462 (diff)
parent376a55c97fcf178abec3091db830215642bf23c1 (diff)
downloadpleroma-31a59d6f23d66f0f4221d2f036e727f22da17615.tar.gz
pleroma-31a59d6f23d66f0f4221d2f036e727f22da17615.zip
Merge branch 'develop' into proxy-error
Diffstat (limited to 'test/web/ostatus')
-rw-r--r--test/web/ostatus/ostatus_test.exs28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/web/ostatus/ostatus_test.exs b/test/web/ostatus/ostatus_test.exs
index f6be16862..acce33008 100644
--- a/test/web/ostatus/ostatus_test.exs
+++ b/test/web/ostatus/ostatus_test.exs
@@ -11,8 +11,10 @@ defmodule Pleroma.Web.OStatusTest do
alias Pleroma.User
alias Pleroma.Web.OStatus
alias Pleroma.Web.XML
- import Pleroma.Factory
+
import ExUnit.CaptureLog
+ import Mock
+ import Pleroma.Factory
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
@@ -266,10 +268,13 @@ defmodule Pleroma.Web.OStatusTest do
assert favorited_activity.local
end
- test "handle incoming replies" do
+ test_with_mock "handle incoming replies, fetching replied-to activities if we don't have them",
+ OStatus,
+ [:passthrough],
+ [] do
incoming = File.read!("test/fixtures/incoming_note_activity_answer.xml")
{:ok, [activity]} = OStatus.handle_incoming(incoming)
- object = Object.normalize(activity.data["object"])
+ object = Object.normalize(activity.data["object"], false)
assert activity.data["type"] == "Create"
assert object.data["type"] == "Note"
@@ -282,6 +287,23 @@ defmodule Pleroma.Web.OStatusTest do
assert object.data["id"] == "tag:gs.example.org:4040,2017-04-25:noticeId=55:objectType=note"
assert "https://www.w3.org/ns/activitystreams#Public" in activity.data["to"]
+
+ assert called(OStatus.fetch_activity_from_url(object.data["inReplyTo"], :_))
+ end
+
+ test_with_mock "handle incoming replies, not fetching replied-to activities beyond max_replies_depth",
+ OStatus,
+ [:passthrough],
+ [] do
+ incoming = File.read!("test/fixtures/incoming_note_activity_answer.xml")
+
+ with_mock Pleroma.Web.Federator,
+ allowed_incoming_reply_depth?: fn _ -> false end do
+ {:ok, [activity]} = OStatus.handle_incoming(incoming)
+ object = Object.normalize(activity.data["object"], false)
+
+ refute called(OStatus.fetch_activity_from_url(object.data["inReplyTo"], :_))
+ end
end
test "handle incoming follows" do