Blame SOURCES/0002-Convert-tests-to-use-python3.patch

d4b2f2
From 653cd0571fe92c9fd4323f93ff23b9720c00fd5f Mon Sep 17 00:00:00 2001
d4b2f2
From: Rob Crittenden <rcritten@redhat.com>
d4b2f2
Date: Tue, 31 Jul 2018 13:09:02 -0400
d4b2f2
Subject: [PATCH] Convert tests to use python3
d4b2f2
d4b2f2
---
d4b2f2
 tests/028-dbus/expected.out                 |  32 +-
d4b2f2
 tests/028-dbus/expected.out.nodsa           |  22 +-
d4b2f2
 tests/028-dbus/prequal.sh                   |   8 +-
d4b2f2
 tests/028-dbus/run.sh                       |   9 +-
d4b2f2
 tests/028-dbus/runsub.sh                    |   2 +-
d4b2f2
 tests/028-dbus/simpleprop.py                |  14 +-
d4b2f2
 tests/028-dbus/walk.py                      | 392 ++++++++++----------
d4b2f2
 tests/038-ms-v2-template/extract-extdata.py |   5 +-
d4b2f2
 8 files changed, 243 insertions(+), 241 deletions(-)
d4b2f2
d4b2f2
diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out
d4b2f2
index ca3179e..1d8bec4 100644
d4b2f2
--- a/tests/028-dbus/expected.out
d4b2f2
+++ b/tests/028-dbus/expected.out
d4b2f2
@@ -1,5 +1,3 @@
d4b2f2
-Certificate in file "${tmpdir}/test.crt" issued by CA and saved.
d4b2f2
-Certificate in file "${tmpdir}/test.crt" issued by CA and saved.
d4b2f2
 [[ getcert ]]
d4b2f2
 State MONITORING, stuck: no.
d4b2f2
 Number of certificates and requests being tracked: 1.
d4b2f2
@@ -187,13 +185,13 @@ dbus.Array([dbus.ObjectPath('/org/fedorahosted/certmonger/cas/CA1'), dbus.Object
d4b2f2
 dbus.Array([dbus.ObjectPath('/org/fedorahosted/certmonger/requests/Request2')], signature=dbus.Signature('o'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger: org.fedorahosted.certmonger.get_supported_key_types ]
d4b2f2
-dbus.Array([dbus.String(u'RSA'), dbus.String(u'DSA'), dbus.String(u'EC')], signature=dbus.Signature('s'))
d4b2f2
+dbus.Array([dbus.String('RSA'), dbus.String('DSA'), dbus.String('EC')], signature=dbus.Signature('s'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger: org.fedorahosted.certmonger.get_supported_key_storage ]
d4b2f2
-dbus.Array([dbus.String(u'NSSDB'), dbus.String(u'FILE')], signature=dbus.Signature('s'))
d4b2f2
+dbus.Array([dbus.String('NSSDB'), dbus.String('FILE')], signature=dbus.Signature('s'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger: org.fedorahosted.certmonger.get_supported_cert_storage ]
d4b2f2
-dbus.Array([dbus.String(u'NSSDB'), dbus.String(u'FILE')], signature=dbus.Signature('s'))
d4b2f2
+dbus.Array([dbus.String('NSSDB'), dbus.String('FILE')], signature=dbus.Signature('s'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger : org.fedorahosted.certmonger.remove_known_ca ]
d4b2f2
 OK
d4b2f2
@@ -433,19 +431,19 @@ Buddy
d4b2f2
 
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_cert_info ]
d4b2f2
-(dbus.String(u'CN=$UUID,CN=Local Signing Authority'), dbus.String(u'$UUID'), dbus.String(u'CN=localhost'), dbus.Int64(tomorrow), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9L), dbus.Array([dbus.String(u'1.3.6.1.5.5.7.3.1')], signature=dbus.Signature('s')))
d4b2f2
+(dbus.String('CN=$UUID,CN=Local Signing Authority'), dbus.String('$UUID'), dbus.String('CN=localhost'), dbus.Int64(tomorrow), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String('localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String('host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9), dbus.Array([dbus.String('1.3.6.1.5.5.7.3.1')], signature=dbus.Signature('s')))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_cert_last_checked ]
d4b2f2
 recently
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_cert_storage_info ]
d4b2f2
-(dbus.String(u'FILE'), dbus.String(u'$tmpdir/test.crt'))
d4b2f2
+(dbus.String('FILE'), dbus.String('$tmpdir/test.crt'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_csr_data ]
d4b2f2
 
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_csr_info ]
d4b2f2
-(dbus.String(u'CN=localhost'), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9L), dbus.Array([dbus.String(u'id-kp-serverAuth')], signature=dbus.Signature('s')))
d4b2f2
+(dbus.String('CN=localhost'), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String('localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String('host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9), dbus.Array([dbus.String('id-kp-serverAuth')], signature=dbus.Signature('s')))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_key_pin ]
d4b2f2
 
d4b2f2
@@ -454,19 +452,19 @@ recently
d4b2f2
 
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_key_storage_info ]
d4b2f2
-(dbus.String(u'FILE'), dbus.String(u'$tmpdir/test.key'))
d4b2f2
+(dbus.String('FILE'), dbus.String('$tmpdir/test.key'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_key_type_and_size ]
d4b2f2
-(dbus.String(u'RSA'), dbus.Int64(512L))
d4b2f2
+(dbus.String('RSA'), dbus.Int64(512))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_monitoring ]
d4b2f2
 1
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_notification_info ]
d4b2f2
-(dbus.String(u'stdout'), dbus.String(u'daemon.notice'))
d4b2f2
+(dbus.String('stdout'), dbus.String('daemon.notice'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_status ]
d4b2f2
-(dbus.String(u'MONITORING'), dbus.Boolean(False))
d4b2f2
+(dbus.String('MONITORING'), dbus.Boolean(False))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_ca ]
d4b2f2
 /org/fedorahosted/certmonger/cas/CA1
d4b2f2
@@ -482,7 +480,7 @@ recently
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2 : org.fedorahosted.certmonger.request.modify ]
d4b2f2
 1 on /org/fedorahosted/certmonger/requests/Request2
d4b2f2
-After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.String(u'1.2.3.4.5.6.7.8.9.10')], signature=dbus.Signature('s'), variant_level=1)
d4b2f2
+After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.String('1.2.3.4.5.6.7.8.9.10')], signature=dbus.Signature('s'), variant_level=1)
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.rekey ]
d4b2f2
 1
d4b2f2
@@ -713,7 +711,7 @@ dbus.Array([], signature=dbus.Signature('s'))
d4b2f2
 </node>
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.get_config_file_path ]
d4b2f2
-$tmpdir/cas/20180327134236
d4b2f2
+$tmpdir/cas/date
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA2: org.fedorahosted.certmonger.ca.get_nickname ]
d4b2f2
 SelfSign
d4b2f2
@@ -828,7 +826,7 @@ dbus.Array([], signature=dbus.Signature('s'))
d4b2f2
 </node>
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA3: org.fedorahosted.certmonger.ca.get_config_file_path ]
d4b2f2
-$tmpdir/cas/20180327134236-1
d4b2f2
+$tmpdir/cas/date-1
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA3: org.fedorahosted.certmonger.ca.get_nickname ]
d4b2f2
 IPA
d4b2f2
@@ -941,7 +939,7 @@ dbus.Array([], signature=dbus.Signature('s'))
d4b2f2
 </node>
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA4: org.fedorahosted.certmonger.ca.get_config_file_path ]
d4b2f2
-$tmpdir/cas/20180327134236-2
d4b2f2
+$tmpdir/cas/date-2
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA4: org.fedorahosted.certmonger.ca.get_nickname ]
d4b2f2
 certmaster
d4b2f2
@@ -1054,7 +1052,7 @@ dbus.Array([], signature=dbus.Signature('s'))
d4b2f2
 </node>
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA5: org.fedorahosted.certmonger.ca.get_config_file_path ]
d4b2f2
-$tmpdir/cas/20180327134236-3
d4b2f2
+$tmpdir/cas/date-3
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/cas/CA5: org.fedorahosted.certmonger.ca.get_nickname ]
d4b2f2
 dogtag-ipa-renew-agent
d4b2f2
diff --git a/tests/028-dbus/expected.out.nodsa b/tests/028-dbus/expected.out.nodsa
d4b2f2
index a23af40..5082ee0 100644
d4b2f2
--- a/tests/028-dbus/expected.out.nodsa
d4b2f2
+++ b/tests/028-dbus/expected.out.nodsa
d4b2f2
@@ -187,13 +187,13 @@ dbus.Array([dbus.ObjectPath('/org/fedorahosted/certmonger/cas/CA1'), dbus.Object
d4b2f2
 dbus.Array([dbus.ObjectPath('/org/fedorahosted/certmonger/requests/Request2')], signature=dbus.Signature('o'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger: org.fedorahosted.certmonger.get_supported_key_types ]
d4b2f2
-dbus.Array([dbus.String(u'RSA'), dbus.String(u'EC')], signature=dbus.Signature('s'))
d4b2f2
+dbus.Array([dbus.String('RSA'), dbus.String('EC')], signature=dbus.Signature('s'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger: org.fedorahosted.certmonger.get_supported_key_storage ]
d4b2f2
-dbus.Array([dbus.String(u'NSSDB'), dbus.String(u'FILE')], signature=dbus.Signature('s'))
d4b2f2
+dbus.Array([dbus.String('NSSDB'), dbus.String('FILE')], signature=dbus.Signature('s'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger: org.fedorahosted.certmonger.get_supported_cert_storage ]
d4b2f2
-dbus.Array([dbus.String(u'NSSDB'), dbus.String(u'FILE')], signature=dbus.Signature('s'))
d4b2f2
+dbus.Array([dbus.String('NSSDB'), dbus.String('FILE')], signature=dbus.Signature('s'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger : org.fedorahosted.certmonger.remove_known_ca ]
d4b2f2
 OK
d4b2f2
@@ -432,19 +432,19 @@ Buddy
d4b2f2
 
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_cert_info ]
d4b2f2
-(dbus.String(u'CN=$UUID,CN=Local Signing Authority'), dbus.String(u'$UUID'), dbus.String(u'CN=localhost'), dbus.Int64(tomorrow), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9L), dbus.Array([dbus.String(u'1.3.6.1.5.5.7.3.1')], signature=dbus.Signature('s')))
d4b2f2
+(dbus.String('CN=$UUID,CN=Local Signing Authority'), dbus.String('$UUID'), dbus.String('CN=localhost'), dbus.Int64(tomorrow), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String('localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String('host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9), dbus.Array([dbus.String('1.3.6.1.5.5.7.3.1')], signature=dbus.Signature('s')))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_cert_last_checked ]
d4b2f2
 recently
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_cert_storage_info ]
d4b2f2
-(dbus.String(u'FILE'), dbus.String(u'$tmpdir/test.crt'))
d4b2f2
+(dbus.String('FILE'), dbus.String('$tmpdir/test.crt'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_csr_data ]
d4b2f2
 
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_csr_info ]
d4b2f2
-(dbus.String(u'CN=localhost'), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String(u'host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9L), dbus.Array([dbus.String(u'id-kp-serverAuth')], signature=dbus.Signature('s')))
d4b2f2
+(dbus.String('CN=localhost'), dbus.Array([], signature=dbus.Signature('s')), dbus.Array([dbus.String('localhost')], signature=dbus.Signature('s')), dbus.Array([dbus.String('host/localhost@LOCALHOST')], signature=dbus.Signature('s')), dbus.Int64(9), dbus.Array([dbus.String('id-kp-serverAuth')], signature=dbus.Signature('s')))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_key_pin ]
d4b2f2
 
d4b2f2
@@ -453,19 +453,19 @@ recently
d4b2f2
 
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_key_storage_info ]
d4b2f2
-(dbus.String(u'FILE'), dbus.String(u'$tmpdir/test.key'))
d4b2f2
+(dbus.String('FILE'), dbus.String('$tmpdir/test.key'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_key_type_and_size ]
d4b2f2
-(dbus.String(u'RSA'), dbus.Int64(512L))
d4b2f2
+(dbus.String('RSA'), dbus.Int64(512))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_monitoring ]
d4b2f2
 1
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_notification_info ]
d4b2f2
-(dbus.String(u'stdout'), dbus.String(u'daemon.notice'))
d4b2f2
+(dbus.String('stdout'), dbus.String('daemon.notice'))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_status ]
d4b2f2
-(dbus.String(u'MONITORING'), dbus.Boolean(False))
d4b2f2
+(dbus.String('MONITORING'), dbus.Boolean(False))
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.get_ca ]
d4b2f2
 /org/fedorahosted/certmonger/cas/CA1
d4b2f2
@@ -481,7 +481,7 @@ recently
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2 : org.fedorahosted.certmonger.request.modify ]
d4b2f2
 1 on /org/fedorahosted/certmonger/requests/Request2
d4b2f2
-After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.String(u'1.2.3.4.5.6.7.8.9.10')], signature=dbus.Signature('s'), variant_level=1)
d4b2f2
+After setting template-eku to 1.2.3.4.5.6.7.8.9.10, we got dbus.Array([dbus.String('1.2.3.4.5.6.7.8.9.10')], signature=dbus.Signature('s'), variant_level=1)
d4b2f2
 
d4b2f2
 [ /org/fedorahosted/certmonger/requests/Request2: org.fedorahosted.certmonger.request.rekey ]
d4b2f2
 1
d4b2f2
diff --git a/tests/028-dbus/prequal.sh b/tests/028-dbus/prequal.sh
d4b2f2
index e645c19..4fe79c8 100755
d4b2f2
--- a/tests/028-dbus/prequal.sh
d4b2f2
+++ b/tests/028-dbus/prequal.sh
d4b2f2
@@ -9,19 +9,19 @@ if test -z "$DBUSDAEMON" ; then
d4b2f2
 	echo dbus-daemon not found
d4b2f2
 	exit 1
d4b2f2
 fi
d4b2f2
-if ! python -c 'import os' 2> /dev/null ; then
d4b2f2
+if ! python3 -c 'import os' 2> /dev/null ; then
d4b2f2
 	echo python not found
d4b2f2
 	exit 1
d4b2f2
 fi
d4b2f2
-if ! python -c 'import dbus' 2> /dev/null ; then
d4b2f2
+if ! python3 -c 'import dbus' 2> /dev/null ; then
d4b2f2
 	echo python-dbus not found
d4b2f2
 	exit 1
d4b2f2
 fi
d4b2f2
-if ! python -c 'import xml' 2> /dev/null ; then
d4b2f2
+if ! python3 -c 'import xml' 2> /dev/null ; then
d4b2f2
 	echo python-xml not found
d4b2f2
 	exit 1
d4b2f2
 fi
d4b2f2
-if ! python -c 'import xml.etree.ElementTree' 2> /dev/null ; then
d4b2f2
+if ! python3 -c 'import xml.etree.ElementTree' 2> /dev/null ; then
d4b2f2
 	echo python-xml does not include etree.ElementTree
d4b2f2
 	exit 1
d4b2f2
 fi
d4b2f2
diff --git a/tests/028-dbus/run.sh b/tests/028-dbus/run.sh
d4b2f2
index c468d51..ee90875 100755
d4b2f2
--- a/tests/028-dbus/run.sh
d4b2f2
+++ b/tests/028-dbus/run.sh
d4b2f2
@@ -23,7 +23,7 @@ EOF
d4b2f2
 $DBUSDAEMON --session --print-address=3 --print-pid=4 --fork 3> $tmpdir/address 4> $tmpdir/pid
d4b2f2
 if test -s $tmpdir/pid ; then
d4b2f2
 	env DBUS_SESSION_BUS_ADDRESS=`cat $tmpdir/address` \
d4b2f2
-	$toolsdir/../../src/certmonger-session -n -c $tmpdir/runsub.sh
d4b2f2
+	$toolsdir/../../src/certmonger-session -n -c $tmpdir/runsub.sh > /dev/null
d4b2f2
 fi
d4b2f2
 kill `cat $tmpdir/pid`
d4b2f2
 
d4b2f2
@@ -33,8 +33,8 @@ now=`date +%s`
d4b2f2
 for i in `seq 240` ; do
d4b2f2
 	recently=$(($now-$i))
d4b2f2
 	tomorrow=$(($now-$i+24*60*60))
d4b2f2
-	sed -i -e s/^$recently'$/recently/g' -e s/"("$recently"L)"/'(recently)'/g \
d4b2f2
-	       -e s/^$tomorrow'$/tomorrow/g' -e s/"("$tomorrow"L)"/'(tomorrow)'/g $tmpdir/runsub.out
d4b2f2
+	sed -i -e s/^$recently'$/recently/g' -e s/"("$recently")"/'(recently)'/g \
d4b2f2
+	       -e s/^$tomorrow'$/tomorrow/g' -e s/"("$tomorrow")"/'(tomorrow)'/g $tmpdir/runsub.out
d4b2f2
 done
d4b2f2
 
d4b2f2
 cat $tmpdir/runsub.out | \
d4b2f2
@@ -43,4 +43,5 @@ sed -r -e 's,CN=........-........-........-........,CN=$UUID,g' \
d4b2f2
        -e "s|$libexecdir|\$libexecdir|g" \
d4b2f2
        -e "s|$tmpdir|\$tmpdir|g" \
d4b2f2
        -e "s|expires:.*|expires: sometime|g" \
d4b2f2
-       -e "s|u'(00)?[0-9a-fA-F]{32}|u'"'$UUID|g'
d4b2f2
+       -e "s|'(00)?[0-9a-fA-F]{32}|'"'$UUID|g' \
d4b2f2
+       -e "s|cas\/[0-9]{14}|cas\/date|g"
d4b2f2
diff --git a/tests/028-dbus/runsub.sh b/tests/028-dbus/runsub.sh
d4b2f2
index 3510d79..fe6766c 100755
d4b2f2
--- a/tests/028-dbus/runsub.sh
d4b2f2
+++ b/tests/028-dbus/runsub.sh
d4b2f2
@@ -22,5 +22,5 @@ echo ""
d4b2f2
 echo "[[ API ]]"
d4b2f2
 for i in ./*.py ; do
d4b2f2
 	echo "[" `basename "$i"` "]"
d4b2f2
-	python $i
d4b2f2
+	python3 $i
d4b2f2
 done
d4b2f2
diff --git a/tests/028-dbus/simpleprop.py b/tests/028-dbus/simpleprop.py
d4b2f2
index e4f937e..35d9591 100644
d4b2f2
--- a/tests/028-dbus/simpleprop.py
d4b2f2
+++ b/tests/028-dbus/simpleprop.py
d4b2f2
@@ -1,4 +1,4 @@
d4b2f2
-#!/usr/bin/python
d4b2f2
+#!/usr/bin/python3
d4b2f2
 import dbus
d4b2f2
 
d4b2f2
 # Get a handle for the main certmonger interface.
d4b2f2
@@ -19,7 +19,7 @@ ca = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
 
d4b2f2
 # Toggle the helper a couple of times.
d4b2f2
 ca_ext_h = o.Get('org.fedorahosted.certmonger.ca', 'external-helper')
d4b2f2
-print ca_ext_h, "->",
d4b2f2
+print(ca_ext_h, "-> ", end='')
d4b2f2
 
d4b2f2
 if ca_ext_h.split()[0] == ca_ext_h:
d4b2f2
     ca_ext_h += ' -k admin@localhost'
d4b2f2
@@ -28,7 +28,7 @@ else:
d4b2f2
 ca.Set('org.fedorahosted.certmonger.ca', 'external-helper', ca_ext_h)
d4b2f2
 
d4b2f2
 ca_ext_h = o.Get('org.fedorahosted.certmonger.ca', 'external-helper')
d4b2f2
-print ca_ext_h, "->",
d4b2f2
+print(ca_ext_h, "-> ", end='')
d4b2f2
 
d4b2f2
 if ca_ext_h.split()[0] == ca_ext_h:
d4b2f2
     ca_ext_h += ' -k admin@localhost'
d4b2f2
@@ -37,20 +37,20 @@ else:
d4b2f2
 ca.Set('org.fedorahosted.certmonger.ca', 'external-helper', ca_ext_h)
d4b2f2
 
d4b2f2
 ca_ext_h = o.Get('org.fedorahosted.certmonger.ca', 'external-helper')
d4b2f2
-print ca_ext_h
d4b2f2
+print(ca_ext_h)
d4b2f2
 
d4b2f2
 # Toggle the "is-default" value a couple of times.
d4b2f2
 isdef = ca.Get('org.fedorahosted.certmonger.ca', 'is-default')
d4b2f2
-print isdef, "->",
d4b2f2
+print(isdef, "-> ", end='')
d4b2f2
 
d4b2f2
 ca.Set('org.fedorahosted.certmonger.ca', 'is-default', not isdef)
d4b2f2
 
d4b2f2
 isdef = ca.Get('org.fedorahosted.certmonger.ca', 'is-default')
d4b2f2
-print isdef, "->",
d4b2f2
+print(isdef, "-> ", end='')
d4b2f2
 
d4b2f2
 ca.Set('org.fedorahosted.certmonger.ca', 'is-default', not isdef)
d4b2f2
 
d4b2f2
 isdef = ca.Get('org.fedorahosted.certmonger.ca', 'is-default')
d4b2f2
-print isdef
d4b2f2
+print(isdef)
d4b2f2
 
d4b2f2
 cm.remove_known_ca(path)
d4b2f2
diff --git a/tests/028-dbus/walk.py b/tests/028-dbus/walk.py
d4b2f2
index f60ca93..683d94e 100644
d4b2f2
--- a/tests/028-dbus/walk.py
d4b2f2
+++ b/tests/028-dbus/walk.py
d4b2f2
@@ -1,4 +1,4 @@
d4b2f2
-#!/usr/bin/python
d4b2f2
+#!/usr/bin/python3
d4b2f2
 import dbus
d4b2f2
 import xml.etree.ElementTree
d4b2f2
 import os
d4b2f2
@@ -9,217 +9,219 @@ bus = dbus.SessionBus()
d4b2f2
 
d4b2f2
 # Check that reading a property directly produces the same value as reading it via GetAll().
d4b2f2
 def check_props(objpath, interface):
d4b2f2
-	o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
-	i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
-	props = i.GetAll(interface)
d4b2f2
-	for prop in props.keys():
d4b2f2
-		value = props[prop]
d4b2f2
-		if value != i.Get(interface, prop):
d4b2f2
-			print("%s: property %s.%s mismatch (%s, %s)" % (objpath, interface, prop, value, i.Get(interface, prop)))
d4b2f2
-			return False
d4b2f2
-	return True
d4b2f2
+    o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
+    i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
+    props = i.GetAll(interface)
d4b2f2
+    for prop in props.keys():
d4b2f2
+        value = props[prop]
d4b2f2
+        if value != i.Get(interface, prop):
d4b2f2
+            print("%s: property %s.%s mismatch (%s, %s)" % (objpath, interface, prop, value, i.Get(interface, prop)))
d4b2f2
+            return False
d4b2f2
+    return True
d4b2f2
 
d4b2f2
 # Try to call the method.
d4b2f2
 def examine_method(objpath, interface, method, idata):
d4b2f2
-	in_args = 0
d4b2f2
-	out_args = 0
d4b2f2
-	o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
-	i = dbus.Interface(o, interface)
d4b2f2
-	for child in idata.getchildren():
d4b2f2
-		if child.tag == 'arg':
d4b2f2
-			if child.get('direction') != 'out':
d4b2f2
-				in_args = in_args + 1
d4b2f2
-			else:
d4b2f2
-				out_args = out_args + 1
d4b2f2
-	if in_args == 0:
d4b2f2
-		# Takes no inputs, so just call it.
d4b2f2
-		m = i.get_dbus_method(method)
d4b2f2
-		if out_args == 0:
d4b2f2
-			m()
d4b2f2
-			print("[ %s: %s.%s ]\n" % (objpath, interface, method))
d4b2f2
-		elif out_args == 1:
d4b2f2
-			result = m()
d4b2f2
-			print("[ %s: %s.%s ]\n%s\n" % (objpath, interface, method, result))
d4b2f2
-		else:
d4b2f2
-			result = m()
d4b2f2
-			print("[ %s: %s.%s ]\n%s\n" % (objpath, interface, method, result))
d4b2f2
-	elif method == 'Get' or method == 'Set' or method == 'GetAll':
d4b2f2
-		# We check on properties elsewhere.
d4b2f2
-		return True
d4b2f2
-	# Per-method exercise.
d4b2f2
-	elif method == 'add_known_ca' or method == 'remove_known_ca':
d4b2f2
-		(result, path) = i.add_known_ca('Test CA', '/usr/bin/env', [])
d4b2f2
-		if not result:
d4b2f2
-			print("[ %s : %s.%s ]: add_known_ca error\n" % (objpath, interface, method))
d4b2f2
-			return False
d4b2f2
-		result = i.remove_known_ca(path)
d4b2f2
-		if not result:
d4b2f2
-			print("[ %s : %s.%s ]: remove_known_ca error\n" % (objpath, interface, method))
d4b2f2
-			return False
d4b2f2
-		print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
-	elif method == 'add_request' or method == 'remove_request':
d4b2f2
-		tmpdir = os.getenv('TMPDIR')
d4b2f2
-		if not tmpdir or tmpdir == '':
d4b2f2
-			tmpdir = '/tmp'
d4b2f2
-		properties = {
d4b2f2
-			'nickname': 'foo',
d4b2f2
-			'cert-storage': 'file',
d4b2f2
-			'cert-file': tmpdir + "/028-certfile",
d4b2f2
-			'key-storage': 'file',
d4b2f2
-			'key-file': tmpdir + "/028-keyfile",
d4b2f2
-			'template-email': ['root@localhost', 'toor@localhost'],
d4b2f2
-		}
d4b2f2
-		(result, path) = i.add_request(properties)
d4b2f2
-		if not result:
d4b2f2
-			print("[ %s : %s.%s ]: add_request error\n" % (objpath, interface, method))
d4b2f2
-			return False
d4b2f2
-		result = i.remove_request(path)
d4b2f2
-		if not result:
d4b2f2
-			print("[ %s : %s.%s ]: remove_request error\n" % (objpath, interface, method))
d4b2f2
-			return False
d4b2f2
-		print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
-	elif method == 'find_ca_by_nickname':
d4b2f2
-		capath = i.find_ca_by_nickname('local')
d4b2f2
-		o = bus.get_object('org.fedorahosted.certmonger', capath)
d4b2f2
-		i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
-		if i.Get('org.fedorahosted.certmonger.ca', 'nickname') != 'local':
d4b2f2
-			print("[ %s : %s.%s ] error: %s\n" % (objpath, interface, method, i.Get('org.fedorahosted.certmonger.ca', 'nickname')))
d4b2f2
-			return False
d4b2f2
-		print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
-	elif method == 'find_request_by_nickname':
d4b2f2
-		reqpath = i.find_request_by_nickname('Buddy')
d4b2f2
-		o = bus.get_object('org.fedorahosted.certmonger', reqpath)
d4b2f2
-		i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
-		if i.Get('org.fedorahosted.certmonger.request', 'nickname') != 'Buddy':
d4b2f2
-			print("[ %s : %s.%s ] error: %s\n" % (objpath, interface, method, i.Get('org.fedorahosted.certmonger.request', 'nickname')))
d4b2f2
-			return False
d4b2f2
-		print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
-	elif method == 'modify':
d4b2f2
-		mods = {}
d4b2f2
-		propname = "template-eku"
d4b2f2
-		propval = '1.2.3.4.5.6.7.8.9.10'
d4b2f2
-		mods[propname] = [propval,]
d4b2f2
-		status, path = i.modify(mods)
d4b2f2
-		if not status:
d4b2f2
-			print("[ %s : %s.%s ] error\n" % (objpath, interface, method))
d4b2f2
-			return False
d4b2f2
-		print("[ %s : %s.%s ]\n%d on %s" % (objpath, interface, method, status, path))
d4b2f2
-		props = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
-		prop = props.Get(interface, 'template-eku')
d4b2f2
-		print("After setting %s to %s, we got %s\n" % (propname, propval, prop))
d4b2f2
-	else:
d4b2f2
-		# We're in FIXME territory.
d4b2f2
-		print('FIXME: need support for "%s"' % method)
d4b2f2
-		return False
d4b2f2
-	# If we caused things to start churning, wait for them to settle.
d4b2f2
+    in_args = 0
d4b2f2
+    out_args = 0
d4b2f2
+    o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
+    i = dbus.Interface(o, interface)
d4b2f2
+    for child in idata.getchildren():
d4b2f2
+        if child.tag == 'arg':
d4b2f2
+            if child.get('direction') != 'out':
d4b2f2
+                in_args = in_args + 1
d4b2f2
+            else:
d4b2f2
+                out_args = out_args + 1
d4b2f2
+    if in_args == 0:
d4b2f2
+        # Takes no inputs, so just call it.
d4b2f2
+        m = i.get_dbus_method(method)
d4b2f2
+        if out_args == 0:
d4b2f2
+            m()
d4b2f2
+            print("[ %s: %s.%s ]\n" % (objpath, interface, method))
d4b2f2
+        elif out_args == 1:
d4b2f2
+            result = m()
d4b2f2
+            print("[ %s: %s.%s ]\n%s\n" % (objpath, interface, method, result))
d4b2f2
+        else:
d4b2f2
+            result = m()
d4b2f2
+            print("[ %s: %s.%s ]\n%s\n" % (objpath, interface, method, result))
d4b2f2
+    elif method == 'Get' or method == 'Set' or method == 'GetAll':
d4b2f2
+        # We check on properties elsewhere.
d4b2f2
+        return True
d4b2f2
+    # Per-method exercise.
d4b2f2
+    elif method == 'add_known_ca' or method == 'remove_known_ca':
d4b2f2
+        (result, path) = i.add_known_ca('Test CA', '/usr/bin/env', [])
d4b2f2
+        if not result:
d4b2f2
+            print("[ %s : %s.%s ]: add_known_ca error\n" % (objpath, interface, method))
d4b2f2
+            return False
d4b2f2
+        result = i.remove_known_ca(path)
d4b2f2
+        if not result:
d4b2f2
+            print("[ %s : %s.%s ]: remove_known_ca error\n" % (objpath, interface, method))
d4b2f2
+            return False
d4b2f2
+        print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
+    elif method == 'add_request' or method == 'remove_request':
d4b2f2
+        tmpdir = os.getenv('TMPDIR')
d4b2f2
+        if not tmpdir or tmpdir == '':
d4b2f2
+            tmpdir = '/tmp'
d4b2f2
+        properties = {
d4b2f2
+            'nickname': 'foo',
d4b2f2
+            'cert-storage': 'file',
d4b2f2
+            'cert-file': tmpdir + "/028-certfile",
d4b2f2
+            'key-storage': 'file',
d4b2f2
+            'key-file': tmpdir + "/028-keyfile",
d4b2f2
+            'template-email': ['root@localhost', 'toor@localhost'],
d4b2f2
+        }
d4b2f2
+        (result, path) = i.add_request(properties)
d4b2f2
+        if not result:
d4b2f2
+            print("[ %s : %s.%s ]: add_request error\n" % (objpath, interface, method))
d4b2f2
+            return False
d4b2f2
+        result = i.remove_request(path)
d4b2f2
+        if not result:
d4b2f2
+            print("[ %s : %s.%s ]: remove_request error\n" % (objpath, interface, method))
d4b2f2
+            return False
d4b2f2
+        print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
+    elif method == 'find_ca_by_nickname':
d4b2f2
+        capath = i.find_ca_by_nickname('local')
d4b2f2
+        o = bus.get_object('org.fedorahosted.certmonger', capath)
d4b2f2
+        i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
+        if i.Get('org.fedorahosted.certmonger.ca', 'nickname') != 'local':
d4b2f2
+            print("[ %s : %s.%s ] error: %s\n" % (objpath, interface, method, i.Get('org.fedorahosted.certmonger.ca', 'nickname')))
d4b2f2
+            return False
d4b2f2
+        print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
+    elif method == 'find_request_by_nickname':
d4b2f2
+        reqpath = i.find_request_by_nickname('Buddy')
d4b2f2
+        if not reqpath:
d4b2f2
+            return False
d4b2f2
+        o = bus.get_object('org.fedorahosted.certmonger', reqpath)
d4b2f2
+        i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
+        if i.Get('org.fedorahosted.certmonger.request', 'nickname') != 'Buddy':
d4b2f2
+            print("[ %s : %s.%s ] error: %s\n" % (objpath, interface, method, i.Get('org.fedorahosted.certmonger.request', 'nickname')))
d4b2f2
+            return False
d4b2f2
+        print("[ %s : %s.%s ]\nOK\n" % (objpath, interface, method))
d4b2f2
+    elif method == 'modify':
d4b2f2
+        mods = {}
d4b2f2
+        propname = "template-eku"
d4b2f2
+        propval = '1.2.3.4.5.6.7.8.9.10'
d4b2f2
+        mods[propname] = [propval,]
d4b2f2
+        status, path = i.modify(mods)
d4b2f2
+        if not status:
d4b2f2
+            print("[ %s : %s.%s ] error\n" % (objpath, interface, method))
d4b2f2
+            return False
d4b2f2
+        print("[ %s : %s.%s ]\n%d on %s" % (objpath, interface, method, status, path))
d4b2f2
+        props = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
+        prop = props.Get(interface, 'template-eku')
d4b2f2
+        print("After setting %s to %s, we got %s\n" % (propname, propval, prop))
d4b2f2
+    else:
d4b2f2
+        # We're in FIXME territory.
d4b2f2
+        print('FIXME: need support for "%s"' % method)
d4b2f2
+        return False
d4b2f2
+    # If we caused things to start churning, wait for them to settle.
d4b2f2
         if method == 'resubmit':
d4b2f2
             props = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
             prop = props.Get(interface, 'status')
d4b2f2
             while prop != 'MONITORING':
d4b2f2
                 time.sleep(1)
d4b2f2
                 prop = props.Get(interface, 'status')
d4b2f2
-	return True
d4b2f2
+    return True
d4b2f2
 
d4b2f2
 def iget(child, proxy, interface, prop):
d4b2f2
-	value = proxy.Get(interface, prop)
d4b2f2
-	if not value:
d4b2f2
-		if child.get('type') == 'b':
d4b2f2
-			value = False
d4b2f2
-		elif child.get('type') == 'n' or child.get('type') == 'x':
d4b2f2
-			value = 0
d4b2f2
-		elif child.get('type') == 's':
d4b2f2
-			value = ''
d4b2f2
-		elif child.get('type') == 'as':
d4b2f2
-			value = ['']
d4b2f2
-		else:
d4b2f2
-			print("%s.%s: %s" % (interface, prop, child.get('type')))
d4b2f2
-			return False
d4b2f2
-	return value
d4b2f2
+    value = proxy.Get(interface, prop)
d4b2f2
+    if not value:
d4b2f2
+        if child.get('type') == 'b':
d4b2f2
+            value = False
d4b2f2
+        elif child.get('type') == 'n' or child.get('type') == 'x':
d4b2f2
+            value = 0
d4b2f2
+        elif child.get('type') == 's':
d4b2f2
+            value = ''
d4b2f2
+        elif child.get('type') == 'as':
d4b2f2
+            value = ['']
d4b2f2
+        else:
d4b2f2
+            print("%s.%s: %s" % (interface, prop, child.get('type')))
d4b2f2
+            return False
d4b2f2
+    return value
d4b2f2
 
d4b2f2
 def examine_interface(objpath, interface, idata):
d4b2f2
-	o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
-	i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
-	for child in idata.getchildren():
d4b2f2
-		if child.tag == 'property':
d4b2f2
-			prop = child.get('name')
d4b2f2
-			if child.get('access') == 'read':
d4b2f2
-				# Check that we can read it.
d4b2f2
-				value = i.Get(interface, prop)
d4b2f2
-			elif child.get('access') == 'readwrite':
d4b2f2
-				if prop == 'external-helper' or prop == 'scep-ca-identifier':
d4b2f2
-					cai = dbus.Interface(o, 'org.fedorahosted.certmonger.ca')
d4b2f2
-					if cai.get_type() != 'EXTERNAL':
d4b2f2
-						print("%s: warning: property %s.%s not settable on this object" % (objpath, interface, prop))
d4b2f2
-						continue
d4b2f2
-				# Check that we can read it, tweak it, and then reset it.
d4b2f2
-				value = iget(child, i, interface, prop)
d4b2f2
-				i.Set(interface, prop, value)
d4b2f2
-				newvalue = None
d4b2f2
-				if child.get('type') == 'b':
d4b2f2
-					newvalue = not value
d4b2f2
-				elif child.get('type') == 'n' or child.get('type') == 'x':
d4b2f2
-					newvalue = value + 1
d4b2f2
-				elif child.get('type') == 's':
d4b2f2
-					newvalue = 'x' + value
d4b2f2
-				elif child.get('type') == 'as':
d4b2f2
-					newvalue = ['x'] + value
d4b2f2
-				else:
d4b2f2
-					print("%s.%s: %s" % (interface, prop, child.get('type')))
d4b2f2
-					return False
d4b2f2
-				if newvalue:
d4b2f2
-					if newvalue == value:
d4b2f2
-						print("%s: error determining new value: (%s, %s): %s" % (objpath, interface, prop, value))
d4b2f2
-						return False
d4b2f2
-					i.Set(interface, prop, newvalue)
d4b2f2
-					if newvalue != iget(child, i, interface, prop):
d4b2f2
-						print("%s: property %s.%s not set: (%s, %s)" % (objpath, interface, prop, value, newvalue))
d4b2f2
-						return False
d4b2f2
-					i.Set(interface, prop, value)
d4b2f2
-					if value != iget(child, i, interface, prop):
d4b2f2
-						print("%s: property %s.%s not reset: (%s, %s)" % (objpath, interface, prop, newvalue, value))
d4b2f2
-						return False
d4b2f2
-		elif child.tag == 'method':
d4b2f2
-			method = child.get('name')
d4b2f2
-			if not examine_method(objpath, interface, method, child):
d4b2f2
-				return False
d4b2f2
-		elif child.tag == 'signal':
d4b2f2
-			continue
d4b2f2
-		else:
d4b2f2
-			print "FIXME: handle child tag %s" % child.tag
d4b2f2
-			return False
d4b2f2
-	return True
d4b2f2
+    o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
+    i = dbus.Interface(o, 'org.freedesktop.DBus.Properties')
d4b2f2
+    for child in idata.getchildren():
d4b2f2
+        if child.tag == 'property':
d4b2f2
+            prop = child.get('name')
d4b2f2
+            if child.get('access') == 'read':
d4b2f2
+                # Check that we can read it.
d4b2f2
+                value = i.Get(interface, prop)
d4b2f2
+            elif child.get('access') == 'readwrite':
d4b2f2
+                if prop == 'external-helper' or prop == 'scep-ca-identifier':
d4b2f2
+                    cai = dbus.Interface(o, 'org.fedorahosted.certmonger.ca')
d4b2f2
+                    if cai.get_type() != 'EXTERNAL':
d4b2f2
+                        print("%s: warning: property %s.%s not settable on this object" % (objpath, interface, prop))
d4b2f2
+                        continue
d4b2f2
+                # Check that we can read it, tweak it, and then reset it.
d4b2f2
+                value = iget(child, i, interface, prop)
d4b2f2
+                i.Set(interface, prop, value)
d4b2f2
+                newvalue = None
d4b2f2
+                if child.get('type') == 'b':
d4b2f2
+                    newvalue = not value
d4b2f2
+                elif child.get('type') == 'n' or child.get('type') == 'x':
d4b2f2
+                    newvalue = value + 1
d4b2f2
+                elif child.get('type') == 's':
d4b2f2
+                    newvalue = 'x' + value
d4b2f2
+                elif child.get('type') == 'as':
d4b2f2
+                    newvalue = ['x'] + value
d4b2f2
+                else:
d4b2f2
+                    print("%s.%s: %s" % (interface, prop, child.get('type')))
d4b2f2
+                    return False
d4b2f2
+                if newvalue:
d4b2f2
+                    if newvalue == value:
d4b2f2
+                        print("%s: error determining new value: (%s, %s): %s" % (objpath, interface, prop, value))
d4b2f2
+                        return False
d4b2f2
+                    i.Set(interface, prop, newvalue)
d4b2f2
+                    if newvalue != iget(child, i, interface, prop):
d4b2f2
+                        print("%s: property %s.%s not set: (%s, %s)" % (objpath, interface, prop, value, newvalue))
d4b2f2
+                        return False
d4b2f2
+                    i.Set(interface, prop, value)
d4b2f2
+                    if value != iget(child, i, interface, prop):
d4b2f2
+                        print("%s: property %s.%s not reset: (%s, %s)" % (objpath, interface, prop, newvalue, value))
d4b2f2
+                        return False
d4b2f2
+        elif child.tag == 'method':
d4b2f2
+            method = child.get('name')
d4b2f2
+            if not examine_method(objpath, interface, method, child):
d4b2f2
+                return False
d4b2f2
+        elif child.tag == 'signal':
d4b2f2
+            continue
d4b2f2
+        else:
d4b2f2
+            print("FIXME: handle child tag %s" % child.tag)
d4b2f2
+            return False
d4b2f2
+    return True
d4b2f2
 
d4b2f2
 def examine_object(objpath):
d4b2f2
-	o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
-	i = dbus.Interface(o, 'org.freedesktop.DBus.Introspectable')
d4b2f2
-	idata = i.Introspect()
d4b2f2
-	x = xml.etree.ElementTree.XML(idata)
d4b2f2
+    o = bus.get_object('org.fedorahosted.certmonger', objpath)
d4b2f2
+    i = dbus.Interface(o, 'org.freedesktop.DBus.Introspectable')
d4b2f2
+    idata = i.Introspect()
d4b2f2
+    x = xml.etree.ElementTree.XML(idata)
d4b2f2
 
d4b2f2
-	# Check if the object supports properties interfaces.
d4b2f2
-	props = False
d4b2f2
-	for child in x.getchildren():
d4b2f2
-		if child.tag == 'interface':
d4b2f2
-			if child.get('name') == 'org.freedesktop.DBus.Properties':
d4b2f2
-				props = True
d4b2f2
+    # Check if the object supports properties interfaces.
d4b2f2
+    props = False
d4b2f2
+    for child in x.getchildren():
d4b2f2
+        if child.tag == 'interface':
d4b2f2
+            if child.get('name') == 'org.freedesktop.DBus.Properties':
d4b2f2
+                props = True
d4b2f2
 
d4b2f2
-	# Look at the interfaces and child nodes.
d4b2f2
-	for child in x.getchildren():
d4b2f2
-		if child.tag == 'interface':
d4b2f2
-			if props and not check_props(objpath, child.get('name')):
d4b2f2
-				return False
d4b2f2
-			if not examine_interface(objpath, child.get('name'), child):
d4b2f2
-				return False
d4b2f2
-		elif child.tag == 'node':
d4b2f2
-			if objpath == '/':
d4b2f2
-				childpath = '/' + child.get('name')
d4b2f2
-			else:
d4b2f2
-				childpath = objpath + '/' + child.get('name')
d4b2f2
-			examine_object(childpath)
d4b2f2
-		else:
d4b2f2
-			print "FIXME: handle child tag %s" % child.tag
d4b2f2
-			return False
d4b2f2
-	return True
d4b2f2
+    # Look at the interfaces and child nodes.
d4b2f2
+    for child in x.getchildren():
d4b2f2
+        if child.tag == 'interface':
d4b2f2
+            if props and not check_props(objpath, child.get('name')):
d4b2f2
+                return False
d4b2f2
+            if not examine_interface(objpath, child.get('name'), child):
d4b2f2
+                return False
d4b2f2
+        elif child.tag == 'node':
d4b2f2
+            if objpath == '/':
d4b2f2
+                childpath = '/' + child.get('name')
d4b2f2
+            else:
d4b2f2
+                childpath = objpath + '/' + child.get('name')
d4b2f2
+            examine_object(childpath)
d4b2f2
+        else:
d4b2f2
+            print("FIXME: handle child tag %s" % child.tag)
d4b2f2
+            return False
d4b2f2
+    return True
d4b2f2
 
d4b2f2
 if not examine_object('/'):
d4b2f2
-	sys.exit(1)
d4b2f2
+    sys.exit(1)
d4b2f2
 sys.exit(0)
d4b2f2
diff --git a/tests/038-ms-v2-template/extract-extdata.py b/tests/038-ms-v2-template/extract-extdata.py
d4b2f2
index 1a845fd..9f9d910 100755
d4b2f2
--- a/tests/038-ms-v2-template/extract-extdata.py
d4b2f2
+++ b/tests/038-ms-v2-template/extract-extdata.py
d4b2f2
@@ -1,10 +1,11 @@
d4b2f2
-#!/usr/bin/python2
d4b2f2
+#!/usr/bin/python3
d4b2f2
 
d4b2f2
 # Given `openssl asn1parse` output of a CSR, look for the V2 Template
d4b2f2
 # extension and output its data if found.  Nonzero exit status if
d4b2f2
 # not found.
d4b2f2
 
d4b2f2
 import binascii
d4b2f2
+import os
d4b2f2
 import re
d4b2f2
 import sys
d4b2f2
 
d4b2f2
@@ -21,7 +22,7 @@ for line in sys.stdin:
d4b2f2
     #
d4b2f2
     if state == STATE_FOUND and 'OCTET STRING' in line:
d4b2f2
         result = re.search(r'\[HEX DUMP\]:(\w*)', line)
d4b2f2
-        sys.stdout.write(binascii.unhexlify(result.group(1)))
d4b2f2
+        os.write(1, binascii.unhexlify(result.group(1)))
d4b2f2
         state = STATE_DONE
d4b2f2
         break
d4b2f2
 
d4b2f2
-- 
d4b2f2
2.17.0
d4b2f2