Revert "add ParentNotFound error, if parent can't be fetched"
This reverts commit 5a9ba266b4.
There is already a NotFetchable error ...
This commit is contained in:
parent
5a9ba266b4
commit
a0f39b4f3a
2 changed files with 2 additions and 20 deletions
|
|
@ -216,7 +216,6 @@ module DiasporaFederation
|
|||
# fetch and receive parent from remote, if not available locally
|
||||
Federation::Fetcher.fetch_public(data[:author], type, guid)
|
||||
data[:parent] = DiasporaFederation.callbacks.trigger(:fetch_related_entity, type, guid)
|
||||
raise ParentNotFound unless data[:parent]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -232,10 +231,6 @@ module DiasporaFederation
|
|||
# Raised, if verify_signatures fails to verify signatures (signatures are wrong)
|
||||
class SignatureVerificationFailed < RuntimeError
|
||||
end
|
||||
|
||||
# Raised, if parent was not found and can't be fetched
|
||||
class ParentNotFound < RuntimeError
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -297,6 +297,8 @@ XML
|
|||
|
||||
context "fetch parent" do
|
||||
before do
|
||||
expect_callback(:fetch_public_key, author).and_return(author_pkey.public_key)
|
||||
expect_callback(:fetch_public_key, remote_parent.author).and_return(parent_pkey.public_key)
|
||||
expect_callback(:fetch_private_key, author).and_return(author_pkey)
|
||||
expect_callback(:fetch_private_key, remote_parent.author).and_return(parent_pkey)
|
||||
end
|
||||
|
|
@ -304,9 +306,6 @@ XML
|
|||
let(:xml) { SomeRelayable.new(hash).to_xml }
|
||||
|
||||
it "fetches the parent from the backend" do
|
||||
expect_callback(:fetch_public_key, author).and_return(author_pkey.public_key)
|
||||
expect_callback(:fetch_public_key, remote_parent.author).and_return(parent_pkey.public_key)
|
||||
|
||||
expect_callback(:fetch_related_entity, "Parent", parent_guid).and_return(remote_parent)
|
||||
expect(Federation::Fetcher).not_to receive(:fetch_public)
|
||||
|
||||
|
|
@ -316,9 +315,6 @@ XML
|
|||
end
|
||||
|
||||
it "fetches the parent from remote if not found on backend" do
|
||||
expect_callback(:fetch_public_key, author).and_return(author_pkey.public_key)
|
||||
expect_callback(:fetch_public_key, remote_parent.author).and_return(parent_pkey.public_key)
|
||||
|
||||
expect_callback(:fetch_related_entity, "Parent", parent_guid).and_return(nil, remote_parent)
|
||||
expect(Federation::Fetcher).to receive(:fetch_public).with(author, "Parent", parent_guid)
|
||||
|
||||
|
|
@ -326,15 +322,6 @@ XML
|
|||
|
||||
expect(entity.parent).to eq(remote_parent)
|
||||
end
|
||||
|
||||
it "raises if the parent can't be fetched from remote" do
|
||||
expect_callback(:fetch_related_entity, "Parent", parent_guid).exactly(2).times.and_return(nil)
|
||||
expect(Federation::Fetcher).to receive(:fetch_public).with(author, "Parent", parent_guid)
|
||||
|
||||
expect {
|
||||
SomeRelayable.from_xml(xml)
|
||||
}.to raise_error DiasporaFederation::Entities::Relayable::ParentNotFound
|
||||
end
|
||||
end
|
||||
|
||||
describe "#sender_valid?" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue