write tests for unescape
This commit is contained in:
parent
e09d524337
commit
35429d105b
1 changed files with 16 additions and 1 deletions
|
|
@ -15,6 +15,13 @@ module DiasporaFederation
|
||||||
post :public, xml: "<diaspora/>"
|
post :public, xml: "<diaspora/>"
|
||||||
expect(response.code).to eq("200")
|
expect(response.code).to eq("200")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "unescapes the xml before sending it to the callback" do
|
||||||
|
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||||
|
.with(:queue_public_receive, "<diaspora/>")
|
||||||
|
|
||||||
|
post :public, xml: CGI::escape("<diaspora/>")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST #private" do
|
describe "POST #private" do
|
||||||
|
|
@ -32,7 +39,7 @@ module DiasporaFederation
|
||||||
expect(response.code).to eq("422")
|
expect(response.code).to eq("422")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns a 200 if receive! reports no errors" do
|
it "returns a 200 if the callback returned true" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||||
.with(:queue_private_receive, "any-guid", "<diaspora/>")
|
.with(:queue_private_receive, "any-guid", "<diaspora/>")
|
||||||
.and_return(true)
|
.and_return(true)
|
||||||
|
|
@ -40,6 +47,14 @@ module DiasporaFederation
|
||||||
post :private, guid: "any-guid", xml: "<diaspora/>"
|
post :private, guid: "any-guid", xml: "<diaspora/>"
|
||||||
expect(response.code).to eq("200")
|
expect(response.code).to eq("200")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "unescapes the xml before sending it to the callback" do
|
||||||
|
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||||
|
.with(:queue_private_receive, "any-guid", "<diaspora/>")
|
||||||
|
.and_return(true)
|
||||||
|
|
||||||
|
post :private, guid: "any-guid", xml: CGI::escape("<diaspora/>")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue