From 5de70e31999eb219bd47aa81b0c003a6c15cf748 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Feb 02 2017 12:43:16 +0000 Subject: py3: tests_xmlrpc: do not call str() on bytes Calling str() on bytes causes undesired side effect: it adds prefix "b" to the result of conversion. The method decode() should be used instead. https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Christian Heimes --- diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py index e5cf091..fa474c6 100644 --- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py +++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py @@ -434,7 +434,7 @@ def santest_csr(request, santest_host_1, santest_host_2): pkey, hashes.SHA256(), backend ).public_bytes(serialization.Encoding.PEM) - return unicode(csr) + return csr.decode('ascii') class SubjectAltNameOneServiceBase(XMLRPC_test): diff --git a/ipatests/test_xmlrpc/test_kerberos_principal_aliases.py b/ipatests/test_xmlrpc/test_kerberos_principal_aliases.py index a1973af..9f062cc 100644 --- a/ipatests/test_xmlrpc/test_kerberos_principal_aliases.py +++ b/ipatests/test_xmlrpc/test_kerberos_principal_aliases.py @@ -260,7 +260,7 @@ class TestKerberosAliasExceptions(XMLRPC_test): # Add an alias overlapping the UPN of a trusted domain upn_suffix = ( trusted_domain_with_suffix['ldif']['ipaNTAdditionalSuffixes'] - ) + ).decode('utf-8') with pytest.raises(errors.ValidationError): krbalias_user.add_principal( @@ -278,7 +278,7 @@ class TestKerberosAliasExceptions(XMLRPC_test): # Add an alias overlapping the NETBIOS name of a trusted domain netbios_name = ( trusted_domain_with_suffix['ldif']['ipaNTFlatName'] - ) + ).decode('utf-8') with pytest.raises(errors.ValidationError): krbalias_user.add_principal(