summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keystone/tests/matchers.py6
-rw-r--r--keystone/tests/test_exception.py8
-rw-r--r--keystone/tests/test_matchers.py6
-rw-r--r--tox.ini1
4 files changed, 11 insertions, 10 deletions
diff --git a/keystone/tests/matchers.py b/keystone/tests/matchers.py
index f904d339c..1b928c0c9 100644
--- a/keystone/tests/matchers.py
+++ b/keystone/tests/matchers.py
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import six
+import io
from lxml import etree
from testtools import matchers
@@ -35,13 +35,13 @@ class XMLEquals(object):
def canonical_xml(s):
s = s.strip()
- fp = six.StringIO()
+ fp = io.BytesIO()
dom = etree.fromstring(s, parser)
dom.getroottree().write_c14n(fp)
s = fp.getvalue()
dom = etree.fromstring(s, parser)
- return etree.tostring(dom, pretty_print=True)
+ return etree.tostring(dom, pretty_print=True).decode('utf-8')
expected = canonical_xml(self.expected)
other = canonical_xml(other)
diff --git a/keystone/tests/test_exception.py b/keystone/tests/test_exception.py
index 3a64578da..a7cb7c3e3 100644
--- a/keystone/tests/test_exception.py
+++ b/keystone/tests/test_exception.py
@@ -89,15 +89,15 @@ class ExceptionTestCase(tests.TestCase):
e = exception.ValidationError(attribute='xx',
target='Long \xe2\x80\x93 Dash')
- self.assertIn(u'\u2013', e.message)
+ self.assertIn(u'\u2013', six.text_type(e))
def test_invalid_unicode_string(self):
# NOTE(jamielennox): This is a complete failure case so what is
- # returned in the e.message is not that important so long as there is
- # an error with a message
+ # returned in the exception message is not that important so long
+ # as there is an error with a message
e = exception.ValidationError(attribute='xx',
target='\xe7a va')
- self.assertIn('%(attribute)', e.message)
+ self.assertIn('%(attribute)', six.text_type(e))
class UnexpectedExceptionTestCase(ExceptionTestCase):
diff --git a/keystone/tests/test_matchers.py b/keystone/tests/test_matchers.py
index 092fa8314..d4215f1ce 100644
--- a/keystone/tests/test_matchers.py
+++ b/keystone/tests/test_matchers.py
@@ -21,19 +21,19 @@ from keystone.tests import matchers
class TestXMLEquals(tests.BaseTestCase, helpers.TestMatchersInterface):
- matches_xml = """
+ matches_xml = b"""
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://docs.openstack.org/identity/api/v2.0">
<success a="a" b="b"/>
</test>
"""
- equivalent_xml = """
+ equivalent_xml = b"""
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://docs.openstack.org/identity/api/v2.0">
<success b="b" a="a"></success>
</test>
"""
- mismatches_xml = """
+ mismatches_xml = b"""
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://docs.openstack.org/identity/api/v2.0">
<nope_it_fails/>
diff --git a/tox.ini b/tox.ini
index 7e314a252..b0bffac9e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -27,6 +27,7 @@ commands =
keystone/tests/test_driver_hints.py \
keystone/tests/test_hacking_checks.py \
keystone/tests/test_injection.py \
+ keystone/tests/test_matchers.py \
keystone/tests/test_policy.py \
keystone/tests/test_s3_token_middleware.py \
keystone/tests/test_singular_plural.py \