diff options
author | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-20 01:03:25 +0300 |
---|---|---|
committer | Roman Chvanikov <chvanikoff@pm.me> | 2019-07-20 01:03:25 +0300 |
commit | 36049f08efadb5f6f727753ecc1f7be6a5b4e3d8 (patch) | |
tree | 2f1e1b5a20ad654cda4021115e621887d2735959 /test/object | |
parent | e7c175c943e9e3f53df76d812c09cfeffdb1c56b (diff) | |
parent | 33729bbb2834bfa1f223b11d47dc8e3230d47657 (diff) | |
download | pleroma-36049f08efadb5f6f727753ecc1f7be6a5b4e3d8.tar.gz pleroma-36049f08efadb5f6f727753ecc1f7be6a5b4e3d8.zip |
Merge develop
Diffstat (limited to 'test/object')
-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 |