diff options
author | kaniini <ariadne@dereferenced.org> | 2019-07-18 13:27:50 +0000 |
---|---|---|
committer | kaniini <ariadne@dereferenced.org> | 2019-07-18 13:27:50 +0000 |
commit | f9a0014681a2054ca9fec9df4729bce8bc0b4060 (patch) | |
tree | edbcc663ace93b90eed6d9b457077b785980a36c /test | |
parent | 1485d75f3c51d8297e23bc64652c7303a7a7e9fb (diff) | |
parent | 7bb50bfcccdc08f72113fda5732b87876eb01df8 (diff) | |
download | pleroma-f9a0014681a2054ca9fec9df4729bce8bc0b4060.tar.gz |
Merge branch 'feature/signed-object-fetches' into 'develop'
signed object fetches
See merge request pleroma/pleroma!1446
Diffstat (limited to 'test')
-rw-r--r-- | test/object/fetcher_test.exs | 30 |
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 |