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

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