summaryrefslogtreecommitdiff
path: root/test/object
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2019-07-19 16:55:10 -0500
committerMark Felder <feld@FreeBSD.org>2019-07-19 16:55:10 -0500
commit9169f331b6d481a0aa2b0bfe91500d695fb1b6d6 (patch)
tree734ce297aef5a2482c88cdc7d03914943ba4cf28 /test/object
parent46c7c53fbbfd9919d429ba15988af0da9e22d444 (diff)
parentc1c64d6d06fb7307245880d6605d9d9153a4784f (diff)
downloadpleroma-9169f331b6d481a0aa2b0bfe91500d695fb1b6d6.tar.gz
pleroma-9169f331b6d481a0aa2b0bfe91500d695fb1b6d6.zip
Merge branch 'develop' into feature/matstodon-statuses-by-name
Diffstat (limited to 'test/object')
-rw-r--r--test/object/fetcher_test.exs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/object/fetcher_test.exs b/test/object/fetcher_test.exs
index 56a9d775f..482252cff 100644
--- a/test/object/fetcher_test.exs
+++ b/test/object/fetcher_test.exs
@@ -150,4 +150,34 @@ defmodule Pleroma.Object.FetcherTest do
assert object.id != object_two.id
end
end
+
+ describe "signed fetches" do
+ test_with_mock "it signs fetches when configured to do so",
+ Pleroma.Signature,
+ [:passthrough],
+ [] do
+ option = Pleroma.Config.get([:activitypub, :sign_object_fetches])
+ Pleroma.Config.put([:activitypub, :sign_object_fetches], true)
+
+ Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
+
+ assert called(Pleroma.Signature.sign(:_, :_))
+
+ Pleroma.Config.put([:activitypub, :sign_object_fetches], option)
+ end
+
+ test_with_mock "it doesn't sign fetches when not configured to do so",
+ Pleroma.Signature,
+ [:passthrough],
+ [] do
+ option = Pleroma.Config.get([:activitypub, :sign_object_fetches])
+ Pleroma.Config.put([:activitypub, :sign_object_fetches], false)
+
+ Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
+
+ refute called(Pleroma.Signature.sign(:_, :_))
+
+ Pleroma.Config.put([:activitypub, :sign_object_fetches], option)
+ end
+ end
end