Skip to content

Commit d976077

Browse files
committed
Merge pull request #22 from mtyaka/default-parser
Don't use default global XML parser to parse response.
2 parents 5af6d58 + 75dd33c commit d976077

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

onelogin/saml/Response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self, request_data, response, signature, _base64=None, _etree=None,
8383

8484
self._request_data = request_data
8585
decoded_response = _base64.b64decode(response)
86-
self._document = _etree.fromstring(decoded_response)
86+
self._document = _etree.fromstring(decoded_response, parser=_etree.XMLParser())
8787
self._signature = signature
8888
self._issuer = issuer
8989

onelogin/saml/test/TestResponse.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ def test__init__(self):
8181

8282
fake_etree = fudge.Fake('etree')
8383
fake_etree.remember_order()
84+
xmlparser = fake_etree.expects('XMLParser')
85+
xmlparser.with_arg_count(0)
86+
fake_xmlparser = fudge.Fake('etree.XMLParser')
87+
xmlparser.returns(fake_xmlparser)
8488
from_string = fake_etree.expects('fromstring')
85-
from_string.with_args('foo decoded response')
89+
from_string.with_args('foo decoded response', parser=fake_xmlparser)
8690
from_string.returns('foo document')
8791

8892
res = Response(

0 commit comments

Comments
 (0)