From a7f6c84bf3a3aba724ac7c734a366d8f33c82156 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 15 May 2016 01:12:32 +0200 Subject: [PATCH] fix TODOs in federation specs --- .../federation/receive_federation_messages_spec.rb | 2 +- .../federation/shared_receive_relayable.rb | 11 +++++------ .../federation/shared_receive_stream_items.rb | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/spec/integration/federation/receive_federation_messages_spec.rb b/spec/integration/federation/receive_federation_messages_spec.rb index e113f072f..4ee743d5c 100644 --- a/spec/integration/federation/receive_federation_messages_spec.rb +++ b/spec/integration/federation/receive_federation_messages_spec.rb @@ -83,7 +83,7 @@ describe "Receive federation messages feature" do it "treats sharing request recive correctly" do entity = FactoryGirl.build(:request_entity, author: sender_id, recipient: alice.diaspora_handle) - # TODO: expect(Diaspora::Fetcher::Public).to receive(:queue_for).exactly(1).times + expect(Workers::ReceiveLocal).to receive(:perform_async).and_call_original post_message(generate_xml(entity, sender, alice), alice) diff --git a/spec/integration/federation/shared_receive_relayable.rb b/spec/integration/federation/shared_receive_relayable.rb index fcf17e788..06e67c247 100644 --- a/spec/integration/federation/shared_receive_relayable.rb +++ b/spec/integration/federation/shared_receive_relayable.rb @@ -3,7 +3,7 @@ shared_examples_for "it deals correctly with a relayable" do let(:entity) { create_relayable_entity(entity_name, local_parent, sender_id) } it "treats upstream receive correctly" do - # TODO: expect(Postzord::Dispatcher).to receive(:build).with(alice, kind_of(klass)).and_call_original + expect(Workers::ReceiveLocal).to receive(:perform_async) post_message(generate_xml(entity, sender, recipient), recipient) received_entity = klass.find_by(guid: entity.guid) @@ -13,7 +13,7 @@ shared_examples_for "it deals correctly with a relayable" do # Checks when a remote pod wants to send us a relayable without having a key for declared diaspora ID it "rejects an upstream entity with a malformed author signature" do - # TODO: expect(Postzord::Dispatcher).not_to receive(:build) + expect(Workers::ReceiveLocal).not_to receive(:perform_async) allow(remote_user_on_pod_b).to receive(:encryption_key).and_return(OpenSSL::PKey::RSA.new(1024)) post_message(generate_xml(entity, sender, recipient), recipient) @@ -26,8 +26,7 @@ shared_examples_for "it deals correctly with a relayable" do let(:entity) { create_relayable_entity(entity_name, remote_parent, author_id) } it "treats downstream receive correctly" do - # TODO: expect(Postzord::Dispatcher).to receive(:build) - # .with(alice, kind_of(klass)).and_call_original unless recipient.nil? + expect(Workers::ReceiveLocal).to receive(:perform_async) post_message(generate_xml(entity, sender, recipient), recipient) @@ -39,7 +38,7 @@ shared_examples_for "it deals correctly with a relayable" do # Checks when a remote pod B wants to send us a relayable with authorship from a remote pod C user # without having correct signature from him. it "rejects a downstream entity with a malformed author signature" do - # TODO: expect(Postzord::Dispatcher).not_to receive(:build) + expect(Workers::ReceiveLocal).not_to receive(:perform_async) allow(remote_user_on_pod_c).to receive(:encryption_key).and_return(OpenSSL::PKey::RSA.new(1024)) post_message(generate_xml(entity, sender, recipient), recipient) @@ -49,7 +48,7 @@ shared_examples_for "it deals correctly with a relayable" do # Checks when a remote pod C wants to send us a relayable from its user, but bypassing the pod B where # remote status came from. it "declines downstream receive when sender signed with a wrong key" do - # TODO: expect(Postzord::Dispatcher).not_to receive(:build) + expect(Workers::ReceiveLocal).not_to receive(:perform_async) allow(sender).to receive(:encryption_key).and_return(OpenSSL::PKey::RSA.new(1024)) post_message(generate_xml(entity, sender, recipient), recipient) diff --git a/spec/integration/federation/shared_receive_stream_items.rb b/spec/integration/federation/shared_receive_stream_items.rb index 77ab41342..7e0df492e 100644 --- a/spec/integration/federation/shared_receive_stream_items.rb +++ b/spec/integration/federation/shared_receive_stream_items.rb @@ -65,7 +65,7 @@ shared_examples_for "messages which are indifferent about sharing fact" do let(:entity) { create_relayable_entity(:participation_entity, local_parent, sender_id) } it "treats participation receive correctly" do - # TODO: expect(Postzord::Dispatcher).to receive(:build).with(alice, kind_of(Participations)).and_call_original + expect(Workers::ReceiveLocal).to receive(:perform_async) post_message(generate_xml(entity, sender, recipient), recipient) received_entity = Participation.find_by(guid: entity.guid) @@ -74,7 +74,7 @@ shared_examples_for "messages which are indifferent about sharing fact" do end it "rejects a participations for a remote parent" do - # TODO: expect(Postzord::Dispatcher).not_to receive(:build) + expect(Workers::ReceiveLocal).not_to receive(:perform_async) entity = create_relayable_entity(:participation_entity, remote_parent, sender_id) post_message(generate_xml(entity, sender, recipient), recipient)