Just test for generic NotFetchable error, which also includes the root author failing to be fetched.
This commit is contained in:
parent
9723bd37a7
commit
4630b49ec4
1 changed files with 9 additions and 14 deletions
|
|
@ -115,14 +115,13 @@ describe ArchiveImporter::PostImporter do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with reshare" do
|
context "with reshare" do
|
||||||
let!(:author) { FactoryGirl.create(:person, diaspora_handle: "author@example.com") }
|
let(:guid) { UUID.generate(:compact) }
|
||||||
let(:entity_json) { JSON.parse(<<~JSON) }
|
let(:entity_json) { JSON.parse(<<~JSON) }
|
||||||
{
|
{
|
||||||
"entity_data" : {
|
"entity_data" : {
|
||||||
"created_at" : "2015-10-19T13:58:16Z",
|
"created_at" : "2015-10-19T13:58:16Z",
|
||||||
"guid" : "#{UUID.generate(:compact)}",
|
"guid" : "#{guid}",
|
||||||
"text" : "test post",
|
"author" : "#{new_user.diaspora_handle}",
|
||||||
"author" : "author@example.com",
|
|
||||||
"root_author": "root_author@remote-pod.com",
|
"root_author": "root_author@remote-pod.com",
|
||||||
"root_guid": "#{UUID.generate(:compact)}"
|
"root_guid": "#{UUID.generate(:compact)}"
|
||||||
},
|
},
|
||||||
|
|
@ -130,20 +129,16 @@ describe ArchiveImporter::PostImporter do
|
||||||
}
|
}
|
||||||
JSON
|
JSON
|
||||||
|
|
||||||
context "when a remote pod responds 403 to discovery requests" do
|
context "with fetch problems" do
|
||||||
before do
|
it "handles unfetchable root post" do
|
||||||
stub_request(:get, "https://remote-pod.com/.well-known/webfinger?resource=acct:root_author@remote-pod.com")
|
allow(DiasporaFederation::Federation::Fetcher).to receive(:fetch_public)
|
||||||
.to_return(status: 403, body: "", headers: {})
|
.and_raise(DiasporaFederation::Federation::Fetcher::NotFetchable)
|
||||||
stub_request(:get, "https://remote-pod.com/.well-known/host-meta")
|
|
||||||
.to_return(status: 403, body: "", headers: {})
|
|
||||||
stub_request(:get, "http://remote-pod.com/.well-known/host-meta")
|
|
||||||
.to_return(status: 403, body: "", headers: {})
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't raise error" do
|
|
||||||
expect {
|
expect {
|
||||||
instance.import
|
instance.import
|
||||||
}.not_to raise_error
|
}.not_to raise_error
|
||||||
|
|
||||||
|
expect(Reshare.find_by(guid: guid)).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue