2023-08-04 21:24:32 +00:00
|
|
|
defmodule Pleroma.Web.XMLTest do
|
|
|
|
use Pleroma.DataCase, async: true
|
|
|
|
|
|
|
|
alias Pleroma.Web.XML
|
|
|
|
|
2023-08-07 10:12:14 +00:00
|
|
|
test "parses normal XML" do
|
|
|
|
data = File.read!("test/fixtures/xml_normal.xml")
|
|
|
|
assert {:ok, _} = XML.parse_document(data)
|
|
|
|
end
|
|
|
|
|
2023-08-05 12:29:29 +00:00
|
|
|
test "refuses to parse any entities from XML" do
|
|
|
|
data = File.read!("test/fixtures/xml_billion_laughs.xml")
|
|
|
|
assert(:error == XML.parse_document(data))
|
|
|
|
end
|
|
|
|
|
2023-08-04 21:24:32 +00:00
|
|
|
test "refuses to load external entities from XML" do
|
|
|
|
data = File.read!("test/fixtures/xml_external_entities.xml")
|
|
|
|
assert(:error == XML.parse_document(data))
|
|
|
|
end
|
|
|
|
end
|