summaryrefslogtreecommitdiff
path: root/openid/test/test_etxrd.py
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@nic.cz>2018-05-03 16:47:01 +0200
committerVlastimil Zíma <vlastimil.zima@nic.cz>2018-05-11 13:39:31 +0200
commitcbc2ed111c1cef8d704d96602d68a6701e5b98d6 (patch)
tree443ab161e01d3135dc35893aab2509f5bd29ca79 /openid/test/test_etxrd.py
parent876e275b4f6c7ce0e3f2354a541e51771f72d89e (diff)
downloadopenid-cbc2ed111c1cef8d704d96602d68a6701e5b98d6.tar.gz
Transform Yadis API to text strings
Diffstat (limited to 'openid/test/test_etxrd.py')
-rw-r--r--openid/test/test_etxrd.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/openid/test/test_etxrd.py b/openid/test/test_etxrd.py
index 2b842d7..6387dbb 100644
--- a/openid/test/test_etxrd.py
+++ b/openid/test/test_etxrd.py
@@ -1,7 +1,10 @@
+from __future__ import unicode_literals
+
import os.path
import tempfile
import unittest
+import six
from lxml import etree
from openid.yadis import etxrd, services, xri
@@ -71,11 +74,11 @@ class TestParseXRDS(unittest.TestCase):
xxe_file.write(xxe_content)
# XXE example from Testing for XML Injection (OTG-INPVAL-008)
# https://www.owasp.org/index.php/Testing_for_XML_Injection_(OTG-INPVAL-008)
- xml = ('<?xml version="1.0" encoding="ISO-8859-1"?>'
- '<!DOCTYPE foo ['
- '<!ELEMENT foo ANY >'
- '<!ENTITY xxe SYSTEM "file://%s" >]>'
- '<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">&xxe;</xrds:XRDS>')
+ xml = (b'<?xml version="1.0" encoding="ISO-8859-1"?>'
+ b'<!DOCTYPE foo ['
+ b'<!ELEMENT foo ANY >'
+ b'<!ENTITY xxe SYSTEM "file://%s" >]>'
+ b'<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">&xxe;</xrds:XRDS>')
tree = etxrd.parseXRDS(xml % tmp_file)
self.assertNotIn(xxe_content, etree.tostring(tree))
finally:
@@ -226,7 +229,7 @@ class TestCanonicalID(unittest.TestCase):
# somewhere in the resolution chain.
def _getCanonicalID(self, iname, xrds, expectedID):
- if isinstance(expectedID, (str, unicode, type(None))):
+ if isinstance(expectedID, six.string_types + (type(None), )):
cid = etxrd.getCanonicalID(iname, xrds)
self.assertEqual(cid, expectedID and xri.XRI(expectedID))
elif issubclass(expectedID, etxrd.XRDSError):