URL: https://github.com/freeipa/freeipa/pull/1284
Author: tiran
 Title: #1284: Py3: Fix vault tests
Action: opened

PR body:
"""
* Bump PKI to 10.5.1-2, which fixes an issue with KRA under Python 3
* Correct encoding of secret

https://pagure.io/freeipa/issue/7033
Obsoletes: #1261
Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1284/head:pr1284
git checkout pr1284
From b8a26c732dc9a6c84ab8c28c6276daf2e2f715d6 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Tue, 14 Nov 2017 16:42:38 +0100
Subject: [PATCH] Py3: Fix vault tests

* Bump PKI to 10.5.1-2, which fixes an issue with KRA under Python 3
* Correct encoding of secret

https://pagure.io/freeipa/issue/7033

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 .gitignore                                |  2 ++
 .travis.yml                               |  2 +-
 freeipa.spec.in                           | 13 +++++++------
 ipatests/test_xmlrpc/test_vault_plugin.py | 18 ++++++++++++------
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8f4c2aa7a9..b0a548b626 100644
--- a/.gitignore
+++ b/.gitignore
@@ -116,3 +116,5 @@ freeipa2-dev-doc
 /ipaplatform/paths.py
 /ipaplatform/services.py
 /ipaplatform/tasks.py
+
+/ipatests/.cache
diff --git a/.travis.yml b/.travis.yml
index 8875b7760d..0caef9115f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -46,7 +46,7 @@ env:
                 test_ipapython
                 test_ipaserver
                 test_integration/test_ipalib_util.py
-                test_xmlrpc/test_[l-uw-z]*.py"
+                test_xmlrpc/test_[l-z]*.py"
                 # FIXME: add vault tests once PKI finally fixes vault
 install:
     - pip install --upgrade pip
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 35cc671aaa..8504823f3b 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -192,7 +192,7 @@ BuildRequires:  python2-dns >= 1.15
 BuildRequires:  jsl
 BuildRequires:  python2-yubico
 # pki Python package
-BuildRequires:  pki-base-python2
+BuildRequires:  pki-base-python2 >= 10.5.1-2
 BuildRequires:  python2-pytest-multihost
 BuildRequires:  python2-pytest-sourceorder
 # 0.4.2: Py3 fix https://bugzilla.redhat.com/show_bug.cgi?id=1476150
@@ -229,7 +229,7 @@ BuildRequires:  python3-qrcode-core >= 5.0.0
 BuildRequires:  python3-dns >= 1.15
 BuildRequires:  python3-yubico
 # pki Python package
-BuildRequires:  pki-base-python3
+BuildRequires:  pki-base-python3 >= 10.5.1-2
 BuildRequires:  python3-pytest-multihost
 BuildRequires:  python3-pytest-sourceorder
 # 0.4.2: Py3 fix https://bugzilla.redhat.com/show_bug.cgi?id=1476150
@@ -327,8 +327,9 @@ Requires(post): systemd-units
 Requires: selinux-policy >= %{selinux_policy_version}
 Requires(post): selinux-policy-base >= %{selinux_policy_version}
 Requires: slapi-nis >= %{slapi_nis_version}
-Requires: pki-ca >= 10.4.0-1
-Requires: pki-kra >= 10.4.0-1
+# 10.5.1-2 contains Python 3 vault fix
+Requires: pki-ca >= 10.5.1-2
+Requires: pki-kra >= 10.5.1-2
 Requires(preun): systemd-units
 Requires(postun): systemd-units
 Requires: policycoreutils >= 2.1.12-5
@@ -392,7 +393,7 @@ Requires: python2-dbus
 Requires: python2-dns >= 1.15
 Requires: python2-kdcproxy >= 0.3
 Requires: rpm-libs
-Requires: pki-base-python2
+Requires: pki-base-python2 >= 10.5.1-2
 Requires: python2-augeas
 
 %description -n python2-ipaserver
@@ -426,7 +427,7 @@ Requires: python3-dns >= 1.15
 Requires: python3-kdcproxy >= 0.3
 Requires: python3-augeas
 Requires: rpm-libs
-Requires: pki-base-python3
+Requires: pki-base-python3 >= 10.5.1-2
 
 %description -n python3-ipaserver
 IPA is an integrated solution to provide centrally managed Identity (users,
diff --git a/ipatests/test_xmlrpc/test_vault_plugin.py b/ipatests/test_xmlrpc/test_vault_plugin.py
index 7023d6a9be..ad58589787 100644
--- a/ipatests/test_xmlrpc/test_vault_plugin.py
+++ b/ipatests/test_xmlrpc/test_vault_plugin.py
@@ -22,9 +22,12 @@
 """
 
 import nose
+import pytest
+import six
+
 from ipalib import api
 from ipatests.test_xmlrpc.xmlrpc_test import Declarative, fuzzy_string
-import pytest
+
 
 vault_name = u'test_vault'
 service_name = u'HTTP/server.example.com'
@@ -35,12 +38,15 @@
 asymmetric_vault_name = u'asymmetric_test_vault'
 
 # binary data from \x00 to \xff
-secret = ''.join(chr(c) for c in range(0, 256))
+if six.PY2:
+    secret = b''.join(chr(c) for c in range(0, 256))
+else:
+    secret = bytes(range(0, 256))
 
 password = u'password'
 other_password = u'other_password'
 
-public_key = """
+public_key = b"""
 -----BEGIN PUBLIC KEY-----
 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnT61EFxUOQgCJdM0tmw/
 pRRPDPGchTClnU1eBtiQD3ItKYf1+weMGwGOSJXPtkto7NlE7Qs8WHAr0UjyeBDe
@@ -52,7 +58,7 @@
 -----END PUBLIC KEY-----
 """
 
-private_key = """
+private_key = b"""
 -----BEGIN RSA PRIVATE KEY-----
 MIIEpAIBAAKCAQEAnT61EFxUOQgCJdM0tmw/pRRPDPGchTClnU1eBtiQD3ItKYf1
 +weMGwGOSJXPtkto7NlE7Qs8WHAr0UjyeBDek/zeB6nSVdk47OdaW1AHrJL+44r2
@@ -82,7 +88,7 @@
 -----END RSA PRIVATE KEY-----
 """
 
-other_public_key = """
+other_public_key = b"""
 -----BEGIN PUBLIC KEY-----
 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv7E/QLVyKjrgDctZ50U7
 rmtL7Ks1QLoccp9WvZJ6WI1rYd0fX5FySS4dI6QTNZc6qww8NeNuZtkoxT9m1wkk
@@ -94,7 +100,7 @@
 -----END PUBLIC KEY-----
 """
 
-other_private_key = """
+other_private_key = b"""
 -----BEGIN RSA PRIVATE KEY-----
 MIIEpgIBAAKCAQEAv7E/QLVyKjrgDctZ50U7rmtL7Ks1QLoccp9WvZJ6WI1rYd0f
 X5FySS4dI6QTNZc6qww8NeNuZtkoxT9m1wkkRl/3wK7fWNLenH/+VHOaTQc20exg
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to