diff options
author | Starfall <us@starfall.systems> | 2020-11-19 10:02:56 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2020-11-19 10:02:56 -0600 |
commit | 383bb3804bdbd6caa442283cc96ef0cdbfdb4575 (patch) | |
tree | 54ecc09c325567ab1cfc4af9ba13ad134d9c3c72 /spec/services/activitypub/process_collection_service_spec.rb | |
parent | 259470ec37dfc5c3d34ed5456adcd3ab1a622a18 (diff) | |
parent | db01f8b942b72eaa2eacbb144261b002f8079c9c (diff) |
Merge branch 'glitch' into main
Diffstat (limited to 'spec/services/activitypub/process_collection_service_spec.rb')
-rw-r--r-- | spec/services/activitypub/process_collection_service_spec.rb | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index b3baf6b6b..00d71a86a 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -22,7 +22,48 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do subject { described_class.new } describe '#call' do - context 'when actor is the sender' + context 'when actor is suspended' do + before do + actor.suspend!(origin: :remote) + end + + %w(Accept Add Announce Block Create Flag Follow Like Move Remove).each do |activity_type| + context "with #{activity_type} activity" do + let(:payload) do + { + '@context': 'https://www.w3.org/ns/activitystreams', + id: 'foo', + type: activity_type, + actor: ActivityPub::TagManager.instance.uri_for(actor), + } + end + + it 'does not process payload' do + expect(ActivityPub::Activity).not_to receive(:factory) + subject.call(json, actor) + end + end + end + + %w(Delete Reject Undo Update).each do |activity_type| + context "with #{activity_type} activity" do + let(:payload) do + { + '@context': 'https://www.w3.org/ns/activitystreams', + id: 'foo', + type: activity_type, + actor: ActivityPub::TagManager.instance.uri_for(actor), + } + end + + it 'processes the payload' do + expect(ActivityPub::Activity).to receive(:factory) + subject.call(json, actor) + end + end + end + end + context 'when actor differs from sender' do let(:forwarder) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/other_account') } |