diff --git a/test/broker/01-connect-anon-denied.py b/test/broker/01-connect-anon-denied.py index 8df8518d..8e9a1e42 100755 --- a/test/broker/01-connect-anon-denied.py +++ b/test/broker/01-connect-anon-denied.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether an anonymous connection is correctly denied. diff --git a/test/broker/01-connect-bad-packet.py b/test/broker/01-connect-bad-packet.py index 723e07e5..002f403d 100755 --- a/test/broker/01-connect-bad-packet.py +++ b/test/broker/01-connect-bad-packet.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a first packet of non-CONNECT is rejected. diff --git a/test/broker/01-connect-disconnect-v5.py b/test/broker/01-connect-disconnect-v5.py index 96dd4d89..e9e499db 100755 --- a/test/broker/01-connect-disconnect-v5.py +++ b/test/broker/01-connect-disconnect-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # loop through the different v5 DISCONNECT reason_code/properties options. diff --git a/test/broker/01-connect-duplicate-v5.py b/test/broker/01-connect-duplicate-v5.py index a7640e7c..73ae16ad 100755 --- a/test/broker/01-connect-duplicate-v5.py +++ b/test/broker/01-connect-duplicate-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a duplicate CONNECT is rejected. MQTT v5 diff --git a/test/broker/01-connect-duplicate.py b/test/broker/01-connect-duplicate.py index d99297b6..88fa0da7 100755 --- a/test/broker/01-connect-duplicate.py +++ b/test/broker/01-connect-duplicate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a duplicate CONNECT is rejected. diff --git a/test/broker/01-connect-invalid-id-0-311.py b/test/broker/01-connect-invalid-id-0-311.py index 41a87701..6124f089 100755 --- a/test/broker/01-connect-invalid-id-0-311.py +++ b/test/broker/01-connect-invalid-id-0-311.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a CONNECT with a zero length client id results in the correct CONNACK packet. diff --git a/test/broker/01-connect-invalid-id-0.py b/test/broker/01-connect-invalid-id-0.py index fff5d7af..6c653e7c 100755 --- a/test/broker/01-connect-invalid-id-0.py +++ b/test/broker/01-connect-invalid-id-0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a CONNECT with a zero length client id results in the correct CONNACK packet. diff --git a/test/broker/01-connect-invalid-id-missing.py b/test/broker/01-connect-invalid-id-missing.py index 63273e93..2dd8113b 100755 --- a/test/broker/01-connect-invalid-id-missing.py +++ b/test/broker/01-connect-invalid-id-missing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a CONNECT with a zero length client id results in the correct CONNACK packet. diff --git a/test/broker/01-connect-invalid-id-utf8.py b/test/broker/01-connect-invalid-id-utf8.py index 99ba1494..bf8aca25 100755 --- a/test/broker/01-connect-invalid-id-utf8.py +++ b/test/broker/01-connect-invalid-id-utf8.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client id with invalid UTF-8 fails. @@ -17,7 +17,7 @@ broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: time.sleep(0.5) - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) # Exception occurs if connack packet returned rc = 0 sock.close() diff --git a/test/broker/01-connect-invalid-protonum.py b/test/broker/01-connect-invalid-protonum.py index 72b2ae90..67a7e557 100755 --- a/test/broker/01-connect-invalid-protonum.py +++ b/test/broker/01-connect-invalid-protonum.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a CONNECT with an invalid protocol number results in the correct CONNACK packet. diff --git a/test/broker/01-connect-invalid-reserved.py b/test/broker/01-connect-invalid-reserved.py index c98869bf..696bdeb1 100755 --- a/test/broker/01-connect-invalid-reserved.py +++ b/test/broker/01-connect-invalid-reserved.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a CONNECT with reserved set to 1 results in a disconnect. MQTT-3.1.2-3 @@ -12,7 +12,7 @@ port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) sock.close() rc = 0 diff --git a/test/broker/01-connect-success-v5.py b/test/broker/01-connect-success-v5.py index 6533ce65..29c7c163 100755 --- a/test/broker/01-connect-success-v5.py +++ b/test/broker/01-connect-success-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a valid CONNECT results in the correct CONNACK packet for MQTT v5. diff --git a/test/broker/01-connect-success.py b/test/broker/01-connect-success.py index 4d3959e1..a8e5f484 100755 --- a/test/broker/01-connect-success.py +++ b/test/broker/01-connect-success.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a valid CONNECT results in the correct CONNACK packet. diff --git a/test/broker/01-connect-uname-invalid-utf8.py b/test/broker/01-connect-uname-invalid-utf8.py index 21313789..453a5796 100755 --- a/test/broker/01-connect-uname-invalid-utf8.py +++ b/test/broker/01-connect-uname-invalid-utf8.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a username with invalid UTF-8 fails. @@ -17,7 +17,7 @@ broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: time.sleep(0.5) - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) # Exception occurs if connack packet returned rc = 0 sock.close() diff --git a/test/broker/01-connect-uname-no-flag.py b/test/broker/01-connect-uname-no-flag.py index a5467927..a5baa123 100755 --- a/test/broker/01-connect-uname-no-flag.py +++ b/test/broker/01-connect-uname-no-flag.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is disconnected if it provides a username but the # username flag is 0. @@ -18,7 +18,7 @@ port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) sock.close() rc = 0 finally: diff --git a/test/broker/01-connect-uname-no-password-denied.py b/test/broker/01-connect-uname-no-password-denied.py index 46885910..d6b6337e 100755 --- a/test/broker/01-connect-uname-no-password-denied.py +++ b/test/broker/01-connect-uname-no-password-denied.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is denied if it provides just a username when it # needs a username and password. diff --git a/test/broker/01-connect-uname-password-denied.py b/test/broker/01-connect-uname-password-denied.py index 4ee76652..ba7265b9 100755 --- a/test/broker/01-connect-uname-password-denied.py +++ b/test/broker/01-connect-uname-password-denied.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is denied if it provides a correct username but # incorrect password. diff --git a/test/broker/01-connect-uname-password-success-no-tls.py b/test/broker/01-connect-uname-password-success-no-tls.py index 93de845e..c4d27c49 100755 --- a/test/broker/01-connect-uname-password-success-no-tls.py +++ b/test/broker/01-connect-uname-password-success-no-tls.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is denied if it provides a correct username but # incorrect password. diff --git a/test/broker/01-connect-uname-password-success.py b/test/broker/01-connect-uname-password-success.py index 93de845e..c4d27c49 100755 --- a/test/broker/01-connect-uname-password-success.py +++ b/test/broker/01-connect-uname-password-success.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is denied if it provides a correct username but # incorrect password. diff --git a/test/broker/01-connect-uname-pwd-no-flag.py b/test/broker/01-connect-uname-pwd-no-flag.py index f09f690e..0de4eea4 100755 --- a/test/broker/01-connect-uname-pwd-no-flag.py +++ b/test/broker/01-connect-uname-pwd-no-flag.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is disconnected if it provides a password but the # password flag is 0. @@ -18,7 +18,7 @@ port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) sock.close() rc = 0 finally: diff --git a/test/broker/02-shared-qos0-v5.py b/test/broker/02-shared-qos0-v5.py index cb62476d..c96f979a 100755 --- a/test/broker/02-shared-qos0-v5.py +++ b/test/broker/02-shared-qos0-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether shared subscriptions work diff --git a/test/broker/02-subhier-crash.py b/test/broker/02-subhier-crash.py index b6cd0f9a..efd18441 100755 --- a/test/broker/02-subhier-crash.py +++ b/test/broker/02-subhier-crash.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test related to https://github.com/eclipse/mosquitto/issues/505 diff --git a/test/broker/02-subpub-qos0-retain-as-publish.py b/test/broker/02-subpub-qos0-retain-as-publish.py index d6436eef..8d4aa0b1 100755 --- a/test/broker/02-subpub-qos0-retain-as-publish.py +++ b/test/broker/02-subpub-qos0-retain-as-publish.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic with retain-as-published set works as expected. # MQTT v5 diff --git a/test/broker/02-subpub-qos0-send-retain.py b/test/broker/02-subpub-qos0-send-retain.py index ed9ba735..efe11742 100755 --- a/test/broker/02-subpub-qos0-send-retain.py +++ b/test/broker/02-subpub-qos0-send-retain.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether "send retain" subscribe options work # MQTT v5 diff --git a/test/broker/02-subpub-qos0-subscription-id.py b/test/broker/02-subpub-qos0-subscription-id.py index c25dda54..c0800fd3 100755 --- a/test/broker/02-subpub-qos0-subscription-id.py +++ b/test/broker/02-subpub-qos0-subscription-id.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does setting and updating subscription identifiers work as expected? # MQTT v5 diff --git a/test/broker/02-subpub-qos0-topic-alias-unknown.py b/test/broker/02-subpub-qos0-topic-alias-unknown.py index a79c19e2..10d7534e 100755 --- a/test/broker/02-subpub-qos0-topic-alias-unknown.py +++ b/test/broker/02-subpub-qos0-topic-alias-unknown.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether "topic alias" works to the broker # MQTT v5 diff --git a/test/broker/02-subpub-qos0-topic-alias.py b/test/broker/02-subpub-qos0-topic-alias.py index 89b86fbf..42afde24 100755 --- a/test/broker/02-subpub-qos0-topic-alias.py +++ b/test/broker/02-subpub-qos0-topic-alias.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether "topic alias" works to the broker # MQTT v5 diff --git a/test/broker/02-subpub-qos0-v5.py b/test/broker/02-subpub-qos0-v5.py index debb06f6..2417c3d4 100755 --- a/test/broker/02-subpub-qos0-v5.py +++ b/test/broker/02-subpub-qos0-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # MQTT v5 diff --git a/test/broker/02-subpub-qos0.py b/test/broker/02-subpub-qos0.py index 803dcb90..106a9940 100755 --- a/test/broker/02-subpub-qos0.py +++ b/test/broker/02-subpub-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. diff --git a/test/broker/02-subpub-qos1-bad-pubcomp.py b/test/broker/02-subpub-qos1-bad-pubcomp.py index dd4a5cd3..1cc7fe96 100755 --- a/test/broker/02-subpub-qos1-bad-pubcomp.py +++ b/test/broker/02-subpub-qos1-bad-pubcomp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test what the broker does if receiving a PUBCOMP in response to a QoS 1 PUBLISH. diff --git a/test/broker/02-subpub-qos1-bad-pubrec.py b/test/broker/02-subpub-qos1-bad-pubrec.py index 65a0de68..bf86c57b 100755 --- a/test/broker/02-subpub-qos1-bad-pubrec.py +++ b/test/broker/02-subpub-qos1-bad-pubrec.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test what the broker does if receiving a PUBREC in response to a QoS 1 PUBLISH. diff --git a/test/broker/02-subpub-qos1-message-expiry-retain.py b/test/broker/02-subpub-qos1-message-expiry-retain.py index e949937a..8a169ab2 100755 --- a/test/broker/02-subpub-qos1-message-expiry-retain.py +++ b/test/broker/02-subpub-qos1-message-expiry-retain.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether the broker reduces the message expiry interval when republishing # a retained message, and eventually removes it. diff --git a/test/broker/02-subpub-qos1-message-expiry-will.py b/test/broker/02-subpub-qos1-message-expiry-will.py index c2e728c5..c84a2e55 100755 --- a/test/broker/02-subpub-qos1-message-expiry-will.py +++ b/test/broker/02-subpub-qos1-message-expiry-will.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether the broker reduces the message expiry interval when republishing a will. # MQTT v5 @@ -24,7 +24,7 @@ suback_packet = mosq_test.gen_suback(mid, 1, proto_ver=5) props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_MESSAGE_EXPIRY_INTERVAL, 10) -helper_connect = mosq_test.gen_connect("helper", proto_ver=5, will_topic="subpub/qos1", will_qos=1, will_payload="message", will_properties=props, keepalive=2) +helper_connect = mosq_test.gen_connect("helper", proto_ver=5, will_topic="subpub/qos1", will_qos=1, will_payload=b"message", will_properties=props, keepalive=2) helper_connack = mosq_test.gen_connack(rc=0, proto_ver=5) #mid=2 diff --git a/test/broker/02-subpub-qos1-message-expiry.py b/test/broker/02-subpub-qos1-message-expiry.py index b1bbac95..dbb66746 100755 --- a/test/broker/02-subpub-qos1-message-expiry.py +++ b/test/broker/02-subpub-qos1-message-expiry.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether the broker reduces the message expiry interval when republishing. # MQTT v5 diff --git a/test/broker/02-subpub-qos1-nolocal.py b/test/broker/02-subpub-qos1-nolocal.py index d66be515..46c38158 100755 --- a/test/broker/02-subpub-qos1-nolocal.py +++ b/test/broker/02-subpub-qos1-nolocal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic does not receive its own message # sent to that topic if no local is set. diff --git a/test/broker/02-subpub-qos1-v5.py b/test/broker/02-subpub-qos1-v5.py index cf87a989..c055cdd0 100755 --- a/test/broker/02-subpub-qos1-v5.py +++ b/test/broker/02-subpub-qos1-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # MQTT v5 diff --git a/test/broker/02-subpub-qos1.py b/test/broker/02-subpub-qos1.py index ca78af11..a477048f 100755 --- a/test/broker/02-subpub-qos1.py +++ b/test/broker/02-subpub-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. diff --git a/test/broker/02-subpub-qos2-bad-puback-1.py b/test/broker/02-subpub-qos2-bad-puback-1.py index cf90dbf4..9c13daf0 100755 --- a/test/broker/02-subpub-qos2-bad-puback-1.py +++ b/test/broker/02-subpub-qos2-bad-puback-1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test what the broker does if receiving a PUBACK in response to a QoS 2 PUBLISH. diff --git a/test/broker/02-subpub-qos2-bad-puback-2.py b/test/broker/02-subpub-qos2-bad-puback-2.py index 20d643de..69da0d31 100755 --- a/test/broker/02-subpub-qos2-bad-puback-2.py +++ b/test/broker/02-subpub-qos2-bad-puback-2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test what the broker does if receiving a PUBACK in response to a QoS 2 PUBREL. diff --git a/test/broker/02-subpub-qos2-bad-pubcomp.py b/test/broker/02-subpub-qos2-bad-pubcomp.py index 4fd6b59b..f56f835f 100755 --- a/test/broker/02-subpub-qos2-bad-pubcomp.py +++ b/test/broker/02-subpub-qos2-bad-pubcomp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test what the broker does if receiving a PUBCOMP in response to a QoS 2 PUBLISH. diff --git a/test/broker/02-subpub-qos2-pubrec-error-helper.py b/test/broker/02-subpub-qos2-pubrec-error-helper.py index 4d1bbc93..721236b3 100755 --- a/test/broker/02-subpub-qos2-pubrec-error-helper.py +++ b/test/broker/02-subpub-qos2-pubrec-error-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/02-subpub-qos2-pubrec-error.py b/test/broker/02-subpub-qos2-pubrec-error.py index 2e3b3d34..e5fdbdc4 100755 --- a/test/broker/02-subpub-qos2-pubrec-error.py +++ b/test/broker/02-subpub-qos2-pubrec-error.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBREC with reason code >= 0x80 is handled correctly diff --git a/test/broker/02-subpub-qos2-receive-maximum-1.py b/test/broker/02-subpub-qos2-receive-maximum-1.py index db291c52..e0c471de 100755 --- a/test/broker/02-subpub-qos2-receive-maximum-1.py +++ b/test/broker/02-subpub-qos2-receive-maximum-1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does the broker respect receive maximum==1? # MQTT v5 diff --git a/test/broker/02-subpub-qos2-receive-maximum-2.py b/test/broker/02-subpub-qos2-receive-maximum-2.py index 66de557d..5a0e6934 100755 --- a/test/broker/02-subpub-qos2-receive-maximum-2.py +++ b/test/broker/02-subpub-qos2-receive-maximum-2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does the broker respect receive maximum==2? # MQTT v5 diff --git a/test/broker/02-subpub-qos2-receive-maximum-helper.py b/test/broker/02-subpub-qos2-receive-maximum-helper.py index 01eb91a6..bc0fbf04 100755 --- a/test/broker/02-subpub-qos2-receive-maximum-helper.py +++ b/test/broker/02-subpub-qos2-receive-maximum-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # MQTT v5 diff --git a/test/broker/02-subpub-qos2-v5.py b/test/broker/02-subpub-qos2-v5.py index 32feaed7..78e3e3ee 100755 --- a/test/broker/02-subpub-qos2-v5.py +++ b/test/broker/02-subpub-qos2-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # MQTT v5 diff --git a/test/broker/02-subpub-qos2.py b/test/broker/02-subpub-qos2.py index f9f941be..6ee47cb1 100755 --- a/test/broker/02-subpub-qos2.py +++ b/test/broker/02-subpub-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. diff --git a/test/broker/02-subscribe-dollar-v5.py b/test/broker/02-subscribe-dollar-v5.py index 11e32b0e..adf8302a 100755 --- a/test/broker/02-subscribe-dollar-v5.py +++ b/test/broker/02-subscribe-dollar-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to $SYS or $share succeeds diff --git a/test/broker/02-subscribe-invalid-utf8.py b/test/broker/02-subscribe-invalid-utf8.py index f9ae5b39..c5ea9aaf 100755 --- a/test/broker/02-subscribe-invalid-utf8.py +++ b/test/broker/02-subscribe-invalid-utf8.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with an invalid UTF-8 topic fails @@ -24,7 +24,7 @@ try: time.sleep(0.5) sock = mosq_test.do_client_connect(connect_packet, connack_packet, port=port) - mosq_test.do_send_receive(sock, subscribe_packet, "", "suback") + mosq_test.do_send_receive(sock, subscribe_packet, b"", "suback") rc = 0 diff --git a/test/broker/02-subscribe-persistence-flipflop.py b/test/broker/02-subscribe-persistence-flipflop.py index 26a627ce..48f4a87e 100755 --- a/test/broker/02-subscribe-persistence-flipflop.py +++ b/test/broker/02-subscribe-persistence-flipflop.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test switching between persistence and a clean session. # diff --git a/test/broker/02-subscribe-qos0.py b/test/broker/02-subscribe-qos0.py index 434a8704..f69b88ce 100755 --- a/test/broker/02-subscribe-qos0.py +++ b/test/broker/02-subscribe-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 0 results in the correct SUBACK packet. diff --git a/test/broker/02-subscribe-qos1.py b/test/broker/02-subscribe-qos1.py index a15290ee..27976c22 100755 --- a/test/broker/02-subscribe-qos1.py +++ b/test/broker/02-subscribe-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 1 results in the correct SUBACK packet. diff --git a/test/broker/02-subscribe-qos2.py b/test/broker/02-subscribe-qos2.py index 9931583c..0017f828 100755 --- a/test/broker/02-subscribe-qos2.py +++ b/test/broker/02-subscribe-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. diff --git a/test/broker/02-unsubscribe-invalid-no-topic.py b/test/broker/02-unsubscribe-invalid-no-topic.py index 3cc1f401..e1cd74df 100755 --- a/test/broker/02-unsubscribe-invalid-no-topic.py +++ b/test/broker/02-unsubscribe-invalid-no-topic.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a UNSUBSCRIBE with no topic results in a disconnect. MQTT-3.10.3-2 @@ -21,7 +21,7 @@ broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: sock = mosq_test.do_client_connect(connect_packet, connack_packet, port=port) - mosq_test.do_send_receive(sock, unsubscribe_packet, "", "disconnect") + mosq_test.do_send_receive(sock, unsubscribe_packet, b"", "disconnect") rc = 0 diff --git a/test/broker/02-unsubscribe-qos0.py b/test/broker/02-unsubscribe-qos0.py index 0d824bd3..026f81a8 100755 --- a/test/broker/02-unsubscribe-qos0.py +++ b/test/broker/02-unsubscribe-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a UNSUBSCRIBE to a topic with QoS 0 results in the correct UNSUBACK packet. # This doesn't assume a subscription exists. diff --git a/test/broker/02-unsubscribe-qos1.py b/test/broker/02-unsubscribe-qos1.py index 4fd25d69..0942a2a6 100755 --- a/test/broker/02-unsubscribe-qos1.py +++ b/test/broker/02-unsubscribe-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 1 results in the correct SUBACK packet. diff --git a/test/broker/02-unsubscribe-qos2-multiple-v5.py b/test/broker/02-unsubscribe-qos2-multiple-v5.py index bbbc40cd..de73e58e 100755 --- a/test/broker/02-unsubscribe-qos2-multiple-v5.py +++ b/test/broker/02-unsubscribe-qos2-multiple-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a v5 UNSUBSCRIBE to multiple topics with QoS 2 results in the # correct UNSUBACK packet, when one subscription exists and the other does not. diff --git a/test/broker/02-unsubscribe-qos2-multiple.py b/test/broker/02-unsubscribe-qos2-multiple.py index b7851f9f..90e28cdc 100755 --- a/test/broker/02-unsubscribe-qos2-multiple.py +++ b/test/broker/02-unsubscribe-qos2-multiple.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to multiple topics with QoS 2 results in the correct SUBACK packet. diff --git a/test/broker/02-unsubscribe-qos2-v5.py b/test/broker/02-unsubscribe-qos2-v5.py index 2936c33b..aae761ba 100755 --- a/test/broker/02-unsubscribe-qos2-v5.py +++ b/test/broker/02-unsubscribe-qos2-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. # MQTT 5 diff --git a/test/broker/02-unsubscribe-qos2.py b/test/broker/02-unsubscribe-qos2.py index 2262c195..4ab53657 100755 --- a/test/broker/02-unsubscribe-qos2.py +++ b/test/broker/02-unsubscribe-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. diff --git a/test/broker/03-pattern-matching-helper.py b/test/broker/03-pattern-matching-helper.py index 6a1f4168..b4114833 100755 --- a/test/broker/03-pattern-matching-helper.py +++ b/test/broker/03-pattern-matching-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-pattern-matching.py b/test/broker/03-pattern-matching.py index 0e7e0e3b..ee37c99f 100755 --- a/test/broker/03-pattern-matching.py +++ b/test/broker/03-pattern-matching.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-b2c-disconnect-qos1-helper.py b/test/broker/03-publish-b2c-disconnect-qos1-helper.py index f86ed175..a46101ec 100755 --- a/test/broker/03-publish-b2c-disconnect-qos1-helper.py +++ b/test/broker/03-publish-b2c-disconnect-qos1-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-b2c-disconnect-qos1.py b/test/broker/03-publish-b2c-disconnect-qos1.py index b95cd576..f29cac84 100755 --- a/test/broker/03-publish-b2c-disconnect-qos1.py +++ b/test/broker/03-publish-b2c-disconnect-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-b2c-disconnect-qos2-helper.py b/test/broker/03-publish-b2c-disconnect-qos2-helper.py index f0c0dcce..4a904d02 100755 --- a/test/broker/03-publish-b2c-disconnect-qos2-helper.py +++ b/test/broker/03-publish-b2c-disconnect-qos2-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow. diff --git a/test/broker/03-publish-b2c-disconnect-qos2.py b/test/broker/03-publish-b2c-disconnect-qos2.py index 30227655..1403174b 100755 --- a/test/broker/03-publish-b2c-disconnect-qos2.py +++ b/test/broker/03-publish-b2c-disconnect-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-b2c-qos1-len-helper.py b/test/broker/03-publish-b2c-qos1-len-helper.py index 3c491c4e..1179ae76 100755 --- a/test/broker/03-publish-b2c-qos1-len-helper.py +++ b/test/broker/03-publish-b2c-qos1-len-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-b2c-qos1-len.py b/test/broker/03-publish-b2c-qos1-len.py index 7be55611..bce5696a 100755 --- a/test/broker/03-publish-b2c-qos1-len.py +++ b/test/broker/03-publish-b2c-qos1-len.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether the broker handles a v5 PUBACK with all combinations # of with/without reason code and properties. diff --git a/test/broker/03-publish-b2c-qos2-len-helper.py b/test/broker/03-publish-b2c-qos2-len-helper.py index e2a9c456..921404f0 100755 --- a/test/broker/03-publish-b2c-qos2-len-helper.py +++ b/test/broker/03-publish-b2c-qos2-len-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-b2c-qos2-len.py b/test/broker/03-publish-b2c-qos2-len.py index 28623a02..f74a4ca2 100755 --- a/test/broker/03-publish-b2c-qos2-len.py +++ b/test/broker/03-publish-b2c-qos2-len.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether the broker handles a v5 PUBREC, PUBCOMP with all combinations # of with/without reason code and properties. diff --git a/test/broker/03-publish-b2c-timeout-qos1-helper.py b/test/broker/03-publish-b2c-timeout-qos1-helper.py index a1d4c829..2621453f 100755 --- a/test/broker/03-publish-b2c-timeout-qos1-helper.py +++ b/test/broker/03-publish-b2c-timeout-qos1-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow. diff --git a/test/broker/03-publish-b2c-timeout-qos1.py b/test/broker/03-publish-b2c-timeout-qos1.py index f5aae3bb..906447f0 100755 --- a/test/broker/03-publish-b2c-timeout-qos1.py +++ b/test/broker/03-publish-b2c-timeout-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. diff --git a/test/broker/03-publish-b2c-timeout-qos2-helper.py b/test/broker/03-publish-b2c-timeout-qos2-helper.py index 66d5384f..da255aff 100755 --- a/test/broker/03-publish-b2c-timeout-qos2-helper.py +++ b/test/broker/03-publish-b2c-timeout-qos2-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow. diff --git a/test/broker/03-publish-b2c-timeout-qos2.py b/test/broker/03-publish-b2c-timeout-qos2.py index 295b1e20..aa38aefa 100755 --- a/test/broker/03-publish-b2c-timeout-qos2.py +++ b/test/broker/03-publish-b2c-timeout-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a SUBSCRIBE to a topic with QoS 2 results in the correct SUBACK packet. diff --git a/test/broker/03-publish-c2b-disconnect-qos2.py b/test/broker/03-publish-c2b-disconnect-qos2.py index d45ffadc..aa4f5eea 100755 --- a/test/broker/03-publish-c2b-disconnect-qos2.py +++ b/test/broker/03-publish-c2b-disconnect-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/03-publish-c2b-qos2-len.py b/test/broker/03-publish-c2b-qos2-len.py index 5f9957fe..d4242c40 100755 --- a/test/broker/03-publish-c2b-qos2-len.py +++ b/test/broker/03-publish-c2b-qos2-len.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether the broker handles a v5 PUBREL with all combinations # of with/without reason code and properties. diff --git a/test/broker/03-publish-c2b-timeout-qos2.py b/test/broker/03-publish-c2b-timeout-qos2.py index c5e3e8df..faf506ce 100755 --- a/test/broker/03-publish-c2b-timeout-qos2.py +++ b/test/broker/03-publish-c2b-timeout-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet # flow. This test introduces delays into the flow in order to force the broker diff --git a/test/broker/03-publish-dollar-v5.py b/test/broker/03-publish-dollar-v5.py index f8cce944..2a13facd 100755 --- a/test/broker/03-publish-dollar-v5.py +++ b/test/broker/03-publish-dollar-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to $ topics QoS 1 results in the expected PUBACK packet. diff --git a/test/broker/03-publish-dollar.py b/test/broker/03-publish-dollar.py index 35b716cf..831dcd9a 100755 --- a/test/broker/03-publish-dollar.py +++ b/test/broker/03-publish-dollar.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic starting with $ succeeds diff --git a/test/broker/03-publish-invalid-utf8.py b/test/broker/03-publish-invalid-utf8.py index fb3788b1..5680aa44 100755 --- a/test/broker/03-publish-invalid-utf8.py +++ b/test/broker/03-publish-invalid-utf8.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with an invalid UTF-8 topic fails @@ -24,7 +24,7 @@ try: time.sleep(0.5) sock = mosq_test.do_client_connect(connect_packet, connack_packet, port=port) - mosq_test.do_send_receive(sock, publish_packet, "", "puback") + mosq_test.do_send_receive(sock, publish_packet, b"", "puback") rc = 0 diff --git a/test/broker/03-publish-qos1-no-subscribers-v5.py b/test/broker/03-publish-qos1-no-subscribers-v5.py index 34c1d469..19815e03 100755 --- a/test/broker/03-publish-qos1-no-subscribers-v5.py +++ b/test/broker/03-publish-qos1-no-subscribers-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 1 results in the correct PUBACK # packet when there are no subscribers. diff --git a/test/broker/03-publish-qos1-queued-bytes.py b/test/broker/03-publish-qos1-queued-bytes.py index f57e381f..5b0da740 100755 --- a/test/broker/03-publish-qos1-queued-bytes.py +++ b/test/broker/03-publish-qos1-queued-bytes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with an offline subscriber results in a queued message import Queue diff --git a/test/broker/03-publish-qos1-retain-disabled.py b/test/broker/03-publish-qos1-retain-disabled.py index bb86fe61..07f86dd5 100755 --- a/test/broker/03-publish-qos1-retain-disabled.py +++ b/test/broker/03-publish-qos1-retain-disabled.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH with a retain set when retains are disabled results in # the correct DISCONNECT. diff --git a/test/broker/03-publish-qos1.py b/test/broker/03-publish-qos1.py index dabf3358..3e55db9b 100755 --- a/test/broker/03-publish-qos1.py +++ b/test/broker/03-publish-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 1 results in the correct PUBACK packet. diff --git a/test/broker/03-publish-qos2.py b/test/broker/03-publish-qos2.py index 2a8ebd47..9f22275f 100755 --- a/test/broker/03-publish-qos2.py +++ b/test/broker/03-publish-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow. diff --git a/test/broker/04-retain-check-source-persist-diff-port.py b/test/broker/04-retain-check-source-persist-diff-port.py index 10ff6426..7cb23d71 100755 --- a/test/broker/04-retain-check-source-persist-diff-port.py +++ b/test/broker/04-retain-check-source-persist-diff-port.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test for CVE-2018-12546, with the broker being stopped to write the persistence file, plus subscriber on different port. diff --git a/test/broker/04-retain-check-source-persist.py b/test/broker/04-retain-check-source-persist.py index c06fddf7..df5fd547 100755 --- a/test/broker/04-retain-check-source-persist.py +++ b/test/broker/04-retain-check-source-persist.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test for CVE-2018-12546, with the broker being stopped to write the persistence file. diff --git a/test/broker/04-retain-check-source.py b/test/broker/04-retain-check-source.py index 17adcb21..d342a964 100755 --- a/test/broker/04-retain-check-source.py +++ b/test/broker/04-retain-check-source.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test for CVE-2018-12546 diff --git a/test/broker/04-retain-qos0-clear.py b/test/broker/04-retain-qos0-clear.py index ea6d122c..ca4c98dd 100755 --- a/test/broker/04-retain-qos0-clear.py +++ b/test/broker/04-retain-qos0-clear.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a retained PUBLISH is cleared when a zero length retained # message is published to a topic. diff --git a/test/broker/04-retain-qos0-fresh.py b/test/broker/04-retain-qos0-fresh.py index 41f21a26..33fe09b5 100755 --- a/test/broker/04-retain-qos0-fresh.py +++ b/test/broker/04-retain-qos0-fresh.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a retained PUBLISH to a topic with QoS 0 is sent with # retain=false to an already subscribed client. diff --git a/test/broker/04-retain-qos0-repeated.py b/test/broker/04-retain-qos0-repeated.py index 54fc0e9e..769cab55 100755 --- a/test/broker/04-retain-qos0-repeated.py +++ b/test/broker/04-retain-qos0-repeated.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a retained PUBLISH to a topic with QoS 0 is actually retained # and delivered when multiple sub/unsub operations are carried out. diff --git a/test/broker/04-retain-qos0.py b/test/broker/04-retain-qos0.py index d6b21902..8bb06430 100755 --- a/test/broker/04-retain-qos0.py +++ b/test/broker/04-retain-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a retained PUBLISH to a topic with QoS 0 is actually retained. diff --git a/test/broker/04-retain-qos1-qos0.py b/test/broker/04-retain-qos1-qos0.py index 3fa96a08..a9dc69ee 100755 --- a/test/broker/04-retain-qos1-qos0.py +++ b/test/broker/04-retain-qos1-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a retained PUBLISH to a topic with QoS 1 is retained. # Subscription is made with QoS 0 so the retained message should also have QoS diff --git a/test/broker/04-retain-upgrade-outgoing-qos.py b/test/broker/04-retain-upgrade-outgoing-qos.py index bccff1d7..ed170cbc 100755 --- a/test/broker/04-retain-upgrade-outgoing-qos.py +++ b/test/broker/04-retain-upgrade-outgoing-qos.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a retained PUBLISH to a topic with QoS 0 is sent with subscriber QoS # when upgrade_outgoing_qos is true diff --git a/test/broker/05-clean-session-qos1-helper.py b/test/broker/05-clean-session-qos1-helper.py index 28abd803..6857aea0 100755 --- a/test/broker/05-clean-session-qos1-helper.py +++ b/test/broker/05-clean-session-qos1-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a clean session client has a QoS 1 message queued for it. diff --git a/test/broker/05-clean-session-qos1.py b/test/broker/05-clean-session-qos1.py index 17265460..f15e829b 100755 --- a/test/broker/05-clean-session-qos1.py +++ b/test/broker/05-clean-session-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a clean session client has a QoS 1 message queued for it. diff --git a/test/broker/05-session-expiry-v5.py b/test/broker/05-session-expiry-v5.py index ebf5585b..26ffb7ec 100755 --- a/test/broker/05-session-expiry-v5.py +++ b/test/broker/05-session-expiry-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # MQTT v5. Test whether session expiry interval works correctly. diff --git a/test/broker/06-bridge-b2br-disconnect-qos1.py b/test/broker/06-bridge-b2br-disconnect-qos1.py index e742bd73..25dae813 100755 --- a/test/broker/06-bridge-b2br-disconnect-qos1.py +++ b/test/broker/06-bridge-b2br-disconnect-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a bridge resend a QoS=1 message correctly after a disconnect? diff --git a/test/broker/06-bridge-b2br-disconnect-qos2.py b/test/broker/06-bridge-b2br-disconnect-qos2.py index 38c86c23..d9e16cd9 100755 --- a/test/broker/06-bridge-b2br-disconnect-qos2.py +++ b/test/broker/06-bridge-b2br-disconnect-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a bridge resend a QoS=1 message correctly after a disconnect? diff --git a/test/broker/06-bridge-b2br-late-connection-retain.py b/test/broker/06-bridge-b2br-late-connection-retain.py index 8c52d667..217bbca9 100755 --- a/test/broker/06-bridge-b2br-late-connection-retain.py +++ b/test/broker/06-bridge-b2br-late-connection-retain.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a bridge queue up retained messages correctly if the remote broker starts up late? diff --git a/test/broker/06-bridge-b2br-late-connection.py b/test/broker/06-bridge-b2br-late-connection.py index 59d5c345..c21f3e55 100755 --- a/test/broker/06-bridge-b2br-late-connection.py +++ b/test/broker/06-bridge-b2br-late-connection.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a bridge queue up messages correctly if the remote broker starts up late? diff --git a/test/broker/06-bridge-b2br-remapping.py b/test/broker/06-bridge-b2br-remapping.py index 3d81e0c2..d31805ec 100755 --- a/test/broker/06-bridge-b2br-remapping.py +++ b/test/broker/06-bridge-b2br-remapping.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test remapping of topic name for incoming message diff --git a/test/broker/06-bridge-br2b-disconnect-qos1-helper.py b/test/broker/06-bridge-br2b-disconnect-qos1-helper.py index 0e50f9ef..14e6651a 100755 --- a/test/broker/06-bridge-br2b-disconnect-qos1-helper.py +++ b/test/broker/06-bridge-br2b-disconnect-qos1-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/06-bridge-br2b-disconnect-qos1.py b/test/broker/06-bridge-br2b-disconnect-qos1.py index 00fdba0f..db34af6f 100755 --- a/test/broker/06-bridge-br2b-disconnect-qos1.py +++ b/test/broker/06-bridge-br2b-disconnect-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a bridge resend a QoS=1 message correctly after a disconnect? diff --git a/test/broker/06-bridge-br2b-disconnect-qos2-helper.py b/test/broker/06-bridge-br2b-disconnect-qos2-helper.py index bcb28d43..ef11ca82 100755 --- a/test/broker/06-bridge-br2b-disconnect-qos2-helper.py +++ b/test/broker/06-bridge-br2b-disconnect-qos2-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/06-bridge-br2b-disconnect-qos2.py b/test/broker/06-bridge-br2b-disconnect-qos2.py index d7469288..13b4efb0 100755 --- a/test/broker/06-bridge-br2b-disconnect-qos2.py +++ b/test/broker/06-bridge-br2b-disconnect-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a bridge resend a QoS=1 message correctly after a disconnect? diff --git a/test/broker/06-bridge-br2b-remapping.py b/test/broker/06-bridge-br2b-remapping.py index 716b2e5a..99bf58a8 100755 --- a/test/broker/06-bridge-br2b-remapping.py +++ b/test/broker/06-bridge-br2b-remapping.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test remapping of topic name for outgoing message diff --git a/test/broker/06-bridge-fail-persist-resend-qos1.py b/test/broker/06-bridge-fail-persist-resend-qos1.py index ece86f99..a84bbf32 100755 --- a/test/broker/06-bridge-fail-persist-resend-qos1.py +++ b/test/broker/06-bridge-fail-persist-resend-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a bridge can cope with an unknown PUBACK diff --git a/test/broker/06-bridge-fail-persist-resend-qos2.py b/test/broker/06-bridge-fail-persist-resend-qos2.py index 7c2df3e2..524dedef 100755 --- a/test/broker/06-bridge-fail-persist-resend-qos2.py +++ b/test/broker/06-bridge-fail-persist-resend-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a bridge can cope with an unknown PUBACK diff --git a/test/broker/06-bridge-per-listener-settings.py b/test/broker/06-bridge-per-listener-settings.py index 4e6e90ad..888c1d6e 100755 --- a/test/broker/06-bridge-per-listener-settings.py +++ b/test/broker/06-bridge-per-listener-settings.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test remapping of topic name for incoming message diff --git a/test/broker/06-bridge-reconnect-local-out-helper.py b/test/broker/06-bridge-reconnect-local-out-helper.py index 66eb425d..359d5089 100755 --- a/test/broker/06-bridge-reconnect-local-out-helper.py +++ b/test/broker/06-bridge-reconnect-local-out-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/06-bridge-reconnect-local-out.py b/test/broker/06-bridge-reconnect-local-out.py index 0b043e52..92557dac 100755 --- a/test/broker/06-bridge-reconnect-local-out.py +++ b/test/broker/06-bridge-reconnect-local-out.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a bridge topics work correctly after reconnection. # Important point here is that persistence is enabled. diff --git a/test/broker/07-will-delay-reconnect.py b/test/broker/07-will-delay-reconnect.py index c5d5ac2e..93a96594 100755 --- a/test/broker/07-will-delay-reconnect.py +++ b/test/broker/07-will-delay-reconnect.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client with a will delay handles correctly on the client reconnecting # First connection is durable, second is clean session, and without a will, so the will should not be received. @@ -16,7 +16,7 @@ def do_test(): connack1_packet = mosq_test.gen_connack(rc=0, proto_ver=5) props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_WILL_DELAY_INTERVAL, 3) - connect2a_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload="will delay", will_properties=props, clean_session=False) + connect2a_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload=b"will delay", will_properties=props, clean_session=False) connack2a_packet = mosq_test.gen_connack(rc=0, proto_ver=5) connect2b_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, clean_session=True) diff --git a/test/broker/07-will-delay-recover.py b/test/broker/07-will-delay-recover.py index dcf0fbda..4e1d3c7a 100755 --- a/test/broker/07-will-delay-recover.py +++ b/test/broker/07-will-delay-recover.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client with a will delay recovers on the client reconnecting # MQTT 5 @@ -16,7 +16,7 @@ def do_test(clean_session): connect_props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_SESSION_EXPIRY_INTERVAL, 30) props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_WILL_DELAY_INTERVAL, 3) - connect2_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload="will delay", will_properties=props, clean_session=clean_session, properties=connect_props) + connect2_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload=b"will delay", will_properties=props, clean_session=clean_session, properties=connect_props) connack2a_packet = mosq_test.gen_connack(rc=0, proto_ver=5) if clean_session == True: connack2b_packet = mosq_test.gen_connack(rc=0, proto_ver=5) diff --git a/test/broker/07-will-delay.py b/test/broker/07-will-delay.py index 997d70c3..b60076fd 100755 --- a/test/broker/07-will-delay.py +++ b/test/broker/07-will-delay.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client will is transmitted with a delay correctly. # MQTT 5 @@ -14,7 +14,7 @@ def do_test(clean_session): connack1_packet = mosq_test.gen_connack(rc=0, proto_ver=5) props = mqtt5_props.gen_uint32_prop(mqtt5_props.PROP_WILL_DELAY_INTERVAL, 3) - connect2_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload="will delay", will_qos=2, will_properties=props, clean_session=clean_session) + connect2_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload=b"will delay", will_qos=2, will_properties=props, clean_session=clean_session) connack2_packet = mosq_test.gen_connack(rc=0, proto_ver=5) subscribe_packet = mosq_test.gen_subscribe(mid, "will/test", 0, proto_ver=5) diff --git a/test/broker/07-will-disconnect-with-will.py b/test/broker/07-will-disconnect-with-will.py index 80e998a2..055c6fbb 100755 --- a/test/broker/07-will-disconnect-with-will.py +++ b/test/broker/07-will-disconnect-with-will.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client will is transmitted when a client disconnects with DISCONNECT with will. # MQTT 5 @@ -13,7 +13,7 @@ def do_test(): connect1_packet = mosq_test.gen_connect("will-qos0-test", keepalive=keepalive, proto_ver=5) connack1_packet = mosq_test.gen_connack(rc=0, proto_ver=5) - connect2_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload="will delay", will_qos=2) + connect2_packet = mosq_test.gen_connect("will-helper", keepalive=keepalive, proto_ver=5, will_topic="will/test", will_payload=b"will delay", will_qos=2) connack2_packet = mosq_test.gen_connack(rc=0, proto_ver=5) disconnect_packet = mosq_test.gen_disconnect(reason_code=4, proto_ver=5) diff --git a/test/broker/07-will-invalid-utf8.py b/test/broker/07-will-invalid-utf8.py index c4c1f1a2..6e139bd5 100755 --- a/test/broker/07-will-invalid-utf8.py +++ b/test/broker/07-will-invalid-utf8.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a will topic with invalid UTF-8 fails @@ -17,7 +17,7 @@ port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", timeout=30, port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", timeout=30, port=port) rc = 0 sock.close() finally: diff --git a/test/broker/07-will-no-flag.py b/test/broker/07-will-no-flag.py index 0b4960e5..5f622eff 100755 --- a/test/broker/07-will-no-flag.py +++ b/test/broker/07-will-no-flag.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is disconnected if it sets the will flag but does # not provide a will payload. @@ -19,7 +19,7 @@ port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) sock.close() rc = 0 finally: diff --git a/test/broker/07-will-null-helper.py b/test/broker/07-will-null-helper.py index 2500185e..7e56f429 100755 --- a/test/broker/07-will-null-helper.py +++ b/test/broker/07-will-null-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Connect a client with a will, then disconnect without DISCONNECT. diff --git a/test/broker/07-will-null-topic.py b/test/broker/07-will-null-topic.py index b9c15943..98c1ba1e 100755 --- a/test/broker/07-will-null-topic.py +++ b/test/broker/07-will-null-topic.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import struct @@ -6,14 +6,14 @@ from mosq_test_helper import * rc = 1 keepalive = 60 -connect_packet = mosq_test.gen_connect("will-null-topic", keepalive=keepalive, will_topic="", will_payload=struct.pack("!4sB7s", "will", 0, "message")) +connect_packet = mosq_test.gen_connect("will-null-topic", keepalive=keepalive, will_topic="", will_payload=struct.pack("!4sB7s", b"will", 0, b"message")) connack_packet = mosq_test.gen_connack(rc=2) port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", timeout=30, port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", timeout=30, port=port) rc = 0 sock.close() finally: diff --git a/test/broker/07-will-null.py b/test/broker/07-will-null.py index 50c00d4e..e715d390 100755 --- a/test/broker/07-will-null.py +++ b/test/broker/07-will-null.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client will is transmitted correctly with a null character in the middle. diff --git a/test/broker/07-will-qos0-helper.py b/test/broker/07-will-qos0-helper.py index f9d42c64..031ed4a6 100755 --- a/test/broker/07-will-qos0-helper.py +++ b/test/broker/07-will-qos0-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Connect a client with a will, then disconnect without DISCONNECT. @@ -6,7 +6,7 @@ from mosq_test_helper import * rc = 1 keepalive = 60 -connect_packet = mosq_test.gen_connect("test-helper", keepalive=keepalive, will_topic="will/qos0/test", will_payload="will-message") +connect_packet = mosq_test.gen_connect("test-helper", keepalive=keepalive, will_topic="will/qos0/test", will_payload=b"will-message") connack_packet = mosq_test.gen_connack(rc=0) port = mosq_test.get_port() diff --git a/test/broker/07-will-qos0.py b/test/broker/07-will-qos0.py index 990e40b4..86566654 100755 --- a/test/broker/07-will-qos0.py +++ b/test/broker/07-will-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client will is transmitted correctly. diff --git a/test/broker/08-ssl-bridge-helper.py b/test/broker/08-ssl-bridge-helper.py index 9ca462f4..85311436 100755 --- a/test/broker/08-ssl-bridge-helper.py +++ b/test/broker/08-ssl-bridge-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/08-ssl-bridge.py b/test/broker/08-ssl-bridge.py index 3163c409..975fdb20 100755 --- a/test/broker/08-ssl-bridge.py +++ b/test/broker/08-ssl-bridge.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/08-ssl-connect-cert-auth-crl.py b/test/broker/08-ssl-connect-cert-auth-crl.py index b68bee05..00650854 100755 --- a/test/broker/08-ssl-connect-cert-auth-crl.py +++ b/test/broker/08-ssl-connect-cert-auth-crl.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/08-ssl-connect-cert-auth-expired.py b/test/broker/08-ssl-connect-cert-auth-expired.py index 836a9b82..7fdd3985 100755 --- a/test/broker/08-ssl-connect-cert-auth-expired.py +++ b/test/broker/08-ssl-connect-cert-auth-expired.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a valid CONNECT results in the correct CONNACK packet using an # SSL connection with client certificates required. diff --git a/test/broker/08-ssl-connect-cert-auth-revoked.py b/test/broker/08-ssl-connect-cert-auth-revoked.py index 97b8f432..ca3d8741 100755 --- a/test/broker/08-ssl-connect-cert-auth-revoked.py +++ b/test/broker/08-ssl-connect-cert-auth-revoked.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/08-ssl-connect-cert-auth-without.py b/test/broker/08-ssl-connect-cert-auth-without.py index f31141e7..2a0405c9 100755 --- a/test/broker/08-ssl-connect-cert-auth-without.py +++ b/test/broker/08-ssl-connect-cert-auth-without.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client can connect without an SSL certificate if one is required. diff --git a/test/broker/08-ssl-connect-cert-auth.py b/test/broker/08-ssl-connect-cert-auth.py index 1f0872d3..96eee07c 100755 --- a/test/broker/08-ssl-connect-cert-auth.py +++ b/test/broker/08-ssl-connect-cert-auth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a valid CONNECT results in the correct CONNACK packet using an SSL connection. diff --git a/test/broker/08-ssl-connect-identity.py b/test/broker/08-ssl-connect-identity.py index 4b7dd280..f860880c 100755 --- a/test/broker/08-ssl-connect-identity.py +++ b/test/broker/08-ssl-connect-identity.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Client connects with a certificate to a server that has use_identity_as_username=true. Shouldn't be rejected. diff --git a/test/broker/08-ssl-connect-no-auth-wrong-ca.py b/test/broker/08-ssl-connect-no-auth-wrong-ca.py index f8cb88e9..48d6346c 100755 --- a/test/broker/08-ssl-connect-no-auth-wrong-ca.py +++ b/test/broker/08-ssl-connect-no-auth-wrong-ca.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a valid CONNECT results in the correct CONNACK packet using an SSL connection. diff --git a/test/broker/08-ssl-connect-no-auth.py b/test/broker/08-ssl-connect-no-auth.py index 838a352a..8a5b6813 100755 --- a/test/broker/08-ssl-connect-no-auth.py +++ b/test/broker/08-ssl-connect-no-auth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a valid CONNECT results in the correct CONNACK packet using an SSL connection. diff --git a/test/broker/08-ssl-connect-no-identity.py b/test/broker/08-ssl-connect-no-identity.py index 6f65fd0c..b14a6d10 100755 --- a/test/broker/08-ssl-connect-no-identity.py +++ b/test/broker/08-ssl-connect-no-identity.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Client connects without a certificate to a server that has use_identity_as_username=true. Should be rejected. diff --git a/test/broker/08-tls-psk-bridge.py b/test/broker/08-tls-psk-bridge.py index 8a184a27..d25167a1 100755 --- a/test/broker/08-tls-psk-bridge.py +++ b/test/broker/08-tls-psk-bridge.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/08-tls-psk-pub.py b/test/broker/08-tls-psk-pub.py index 383014a6..cd2624e7 100755 --- a/test/broker/08-tls-psk-pub.py +++ b/test/broker/08-tls-psk-pub.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/09-acl-access-variants.py b/test/broker/09-acl-access-variants.py index a05523b9..406d8057 100755 --- a/test/broker/09-acl-access-variants.py +++ b/test/broker/09-acl-access-variants.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check access diff --git a/test/broker/09-acl-empty-file.py b/test/broker/09-acl-empty-file.py index e43b5e26..08d0b877 100755 --- a/test/broker/09-acl-empty-file.py +++ b/test/broker/09-acl-empty-file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test for CVE-2018-xxxxx diff --git a/test/broker/09-auth-bad-method.py b/test/broker/09-auth-bad-method.py index e83178ac..11696760 100755 --- a/test/broker/09-auth-bad-method.py +++ b/test/broker/09-auth-bad-method.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether sending an Authentication Method produces the correct response # when no auth methods are defined. diff --git a/test/broker/09-plugin-auth-acl-sub-denied.py b/test/broker/09-plugin-auth-acl-sub-denied.py index 67051129..a0261069 100755 --- a/test/broker/09-plugin-auth-acl-sub-denied.py +++ b/test/broker/09-plugin-auth-acl-sub-denied.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test topic subscription. All SUBSCRIBE requests are denied. Check this # produces the correct response, and check the client isn't disconnected (ref: diff --git a/test/broker/09-plugin-auth-acl-sub.py b/test/broker/09-plugin-auth-acl-sub.py index 111d5477..d0427cd6 100755 --- a/test/broker/09-plugin-auth-acl-sub.py +++ b/test/broker/09-plugin-auth-acl-sub.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test topic subscription. All topic are allowed but not using wildcard in subscribe. diff --git a/test/broker/09-plugin-auth-context-params.py b/test/broker/09-plugin-auth-context-params.py index bb780d64..d7459d5f 100755 --- a/test/broker/09-plugin-auth-context-params.py +++ b/test/broker/09-plugin-auth-context-params.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether message parameters are passed to the plugin acl check function. diff --git a/test/broker/09-plugin-auth-defer-unpwd-fail.py b/test/broker/09-plugin-auth-defer-unpwd-fail.py index 07521a87..5009ce62 100755 --- a/test/broker/09-plugin-auth-defer-unpwd-fail.py +++ b/test/broker/09-plugin-auth-defer-unpwd-fail.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection fail when using a auth_plugin that defer authentication. diff --git a/test/broker/09-plugin-auth-defer-unpwd-success.py b/test/broker/09-plugin-auth-defer-unpwd-success.py index 77bf0d72..12e79b83 100755 --- a/test/broker/09-plugin-auth-defer-unpwd-success.py +++ b/test/broker/09-plugin-auth-defer-unpwd-success.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is successful with correct username and password # when using a two auth_plugin (first will defer, second will accept). diff --git a/test/broker/09-plugin-auth-msg-params.py b/test/broker/09-plugin-auth-msg-params.py index 38a4ecc6..5e54bb4d 100755 --- a/test/broker/09-plugin-auth-msg-params.py +++ b/test/broker/09-plugin-auth-msg-params.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether message parameters are passed to the plugin acl check function. diff --git a/test/broker/09-plugin-auth-unpwd-fail.py b/test/broker/09-plugin-auth-unpwd-fail.py index 8e50fca3..999ab50b 100755 --- a/test/broker/09-plugin-auth-unpwd-fail.py +++ b/test/broker/09-plugin-auth-unpwd-fail.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is successful with correct username and password # when using a simple auth_plugin. diff --git a/test/broker/09-plugin-auth-unpwd-success.py b/test/broker/09-plugin-auth-unpwd-success.py index 27908509..f88560c0 100755 --- a/test/broker/09-plugin-auth-unpwd-success.py +++ b/test/broker/09-plugin-auth-unpwd-success.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is successful with correct username and password # when using a simple auth_plugin. diff --git a/test/broker/09-plugin-auth-v2-unpwd-fail.py b/test/broker/09-plugin-auth-v2-unpwd-fail.py index 65837917..bc914785 100755 --- a/test/broker/09-plugin-auth-v2-unpwd-fail.py +++ b/test/broker/09-plugin-auth-v2-unpwd-fail.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is successful with correct username and password # when using a simple auth_plugin. diff --git a/test/broker/09-plugin-auth-v2-unpwd-success.py b/test/broker/09-plugin-auth-v2-unpwd-success.py index 3cc6d7b9..8bc03576 100755 --- a/test/broker/09-plugin-auth-v2-unpwd-success.py +++ b/test/broker/09-plugin-auth-v2-unpwd-success.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a connection is successful with correct username and password # when using a simple auth_plugin. diff --git a/test/broker/09-pwfile-parse-invalid.py b/test/broker/09-pwfile-parse-invalid.py index d2f3616a..e11b7e52 100755 --- a/test/broker/09-pwfile-parse-invalid.py +++ b/test/broker/09-pwfile-parse-invalid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test for CVE-2018-xxxxx. diff --git a/test/broker/10-listener-mount-point-helper.py b/test/broker/10-listener-mount-point-helper.py index a6a91259..1612e751 100755 --- a/test/broker/10-listener-mount-point-helper.py +++ b/test/broker/10-listener-mount-point-helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/10-listener-mount-point.py b/test/broker/10-listener-mount-point.py index f190770b..c84e1d63 100755 --- a/test/broker/10-listener-mount-point.py +++ b/test/broker/10-listener-mount-point.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/broker/11-message-expiry.py b/test/broker/11-message-expiry.py index a184a31b..ae7c6529 100755 --- a/test/broker/11-message-expiry.py +++ b/test/broker/11-message-expiry.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether the broker reduces the message expiry interval when republishing. # MQTT v5, with a broker restart and persistence. diff --git a/test/broker/11-persistent-subscription-no-local.py b/test/broker/11-persistent-subscription-no-local.py index d6c8edad..d25172cf 100755 --- a/test/broker/11-persistent-subscription-no-local.py +++ b/test/broker/11-persistent-subscription-no-local.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # And whether the no-local option is persisted. diff --git a/test/broker/11-persistent-subscription-v5.py b/test/broker/11-persistent-subscription-v5.py index f3d825f5..9cee0694 100755 --- a/test/broker/11-persistent-subscription-v5.py +++ b/test/broker/11-persistent-subscription-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. diff --git a/test/broker/11-persistent-subscription.py b/test/broker/11-persistent-subscription.py index 5ac367c4..a376b7d0 100755 --- a/test/broker/11-persistent-subscription.py +++ b/test/broker/11-persistent-subscription.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. diff --git a/test/broker/11-pub-props.py b/test/broker/11-pub-props.py index 845ed2c4..d96661ac 100755 --- a/test/broker/11-pub-props.py +++ b/test/broker/11-pub-props.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Does a persisted PUBLISH keep its properties? diff --git a/test/broker/11-subscription-id.py b/test/broker/11-subscription-id.py index ed0ea67e..3a36cab0 100755 --- a/test/broker/11-subscription-id.py +++ b/test/broker/11-subscription-id.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client message maintains its subscription id when persisted and restored. diff --git a/test/broker/12-prop-assigned-client-identifier.py b/test/broker/12-prop-assigned-client-identifier.py index 2e85c278..9b4f3e04 100755 --- a/test/broker/12-prop-assigned-client-identifier.py +++ b/test/broker/12-prop-assigned-client-identifier.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether sending a non zero session expiry interval in DISCONNECT after # having sent a zero session expiry interval is treated correctly in MQTT v5. diff --git a/test/broker/12-prop-maximum-packet-size-broker.py b/test/broker/12-prop-maximum-packet-size-broker.py index 7d76d868..fec46c6b 100755 --- a/test/broker/12-prop-maximum-packet-size-broker.py +++ b/test/broker/12-prop-maximum-packet-size-broker.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether the broker disconnects a client nicely when they send a too large packet. diff --git a/test/broker/12-prop-maximum-packet-size-connect.py b/test/broker/12-prop-maximum-packet-size-connect.py index 11936088..294bac04 100755 --- a/test/broker/12-prop-maximum-packet-size-connect.py +++ b/test/broker/12-prop-maximum-packet-size-connect.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether setting maximum packet size to smaller than a CONNACK packet # results in the CONNECT being rejected. @@ -16,7 +16,7 @@ port = mosq_test.get_port() broker = mosq_test.start_broker(filename=os.path.basename(__file__), port=port) try: - sock = mosq_test.do_client_connect(connect_packet, "", port=port) + sock = mosq_test.do_client_connect(connect_packet, b"", port=port) # Exception occurs if connack packet returned rc = 0 finally: diff --git a/test/broker/12-prop-maximum-packet-size-publish-qos1.py b/test/broker/12-prop-maximum-packet-size-publish-qos1.py index 87388bdb..f9c92f98 100755 --- a/test/broker/12-prop-maximum-packet-size-publish-qos1.py +++ b/test/broker/12-prop-maximum-packet-size-publish-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether maximum packet size is honoured on a PUBLISH to a client # MQTTv5 diff --git a/test/broker/12-prop-maximum-packet-size-publish-qos2.py b/test/broker/12-prop-maximum-packet-size-publish-qos2.py index 05e38e8d..10962641 100755 --- a/test/broker/12-prop-maximum-packet-size-publish-qos2.py +++ b/test/broker/12-prop-maximum-packet-size-publish-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether maximum packet size is honoured on a PUBLISH to a client # MQTTv5 diff --git a/test/broker/12-prop-maximum-packet-size-publish.py b/test/broker/12-prop-maximum-packet-size-publish.py index 9db5ad39..7599e811 100755 --- a/test/broker/12-prop-maximum-packet-size-publish.py +++ b/test/broker/12-prop-maximum-packet-size-publish.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether maximum packet size is honoured on a PUBLISH to a client # MQTTv5 diff --git a/test/broker/12-prop-response-topic-correlation-data.py b/test/broker/12-prop-response-topic-correlation-data.py index 13a64760..ae641a44 100755 --- a/test/broker/12-prop-response-topic-correlation-data.py +++ b/test/broker/12-prop-response-topic-correlation-data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # client 1 subscribes to normal-topic # client 2 susbscribes to response-topic diff --git a/test/broker/12-prop-response-topic.py b/test/broker/12-prop-response-topic.py index ddfbf936..acea967c 100755 --- a/test/broker/12-prop-response-topic.py +++ b/test/broker/12-prop-response-topic.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # client 1 subscribes to normal-topic # client 2 susbscribes to response-topic diff --git a/test/broker/12-prop-server-keepalive.py b/test/broker/12-prop-server-keepalive.py index 5073f28c..1e7a6c80 100755 --- a/test/broker/12-prop-server-keepalive.py +++ b/test/broker/12-prop-server-keepalive.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether sending a non zero session expiry interval in DISCONNECT after # having sent a zero session expiry interval is treated correctly in MQTT v5. diff --git a/test/broker/12-prop-session-expiry-invalid.py b/test/broker/12-prop-session-expiry-invalid.py index 81cd7b5e..96612d48 100755 --- a/test/broker/12-prop-session-expiry-invalid.py +++ b/test/broker/12-prop-session-expiry-invalid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether sending a non zero session expiry interval in DISCONNECT after # having sent a zero session expiry interval is treated correctly in MQTT v5. diff --git a/test/broker/12-prop-subpub-content-type.py b/test/broker/12-prop-subpub-content-type.py index d7106d15..2fa453b6 100755 --- a/test/broker/12-prop-subpub-content-type.py +++ b/test/broker/12-prop-subpub-content-type.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # Does the Content Type property get sent through? diff --git a/test/broker/12-prop-subpub-payload-format.py b/test/broker/12-prop-subpub-payload-format.py index 8cbd90e1..99c6a6b9 100755 --- a/test/broker/12-prop-subpub-payload-format.py +++ b/test/broker/12-prop-subpub-payload-format.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # Does the Payload Format Indicator property get sent through? diff --git a/test/broker/12-prop-topic-alias-invalid.py b/test/broker/12-prop-topic-alias-invalid.py index e45bb548..a02c02cc 100755 --- a/test/broker/12-prop-topic-alias-invalid.py +++ b/test/broker/12-prop-topic-alias-invalid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether the broker handles a topic alias of >max_topic_alias correctly. # MQTTv5 diff --git a/test/broker/prop_subpub_helper.py b/test/broker/prop_subpub_helper.py index 212e4d7e..4aa676aa 100755 --- a/test/broker/prop_subpub_helper.py +++ b/test/broker/prop_subpub_helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client subscribed to a topic receives its own message sent to that topic. # Does a given property get sent through? diff --git a/test/lib/01-con-discon-success.py b/test/lib/01-con-discon-success.py index 6838c587..469ecb11 100755 --- a/test/lib/01-con-discon-success.py +++ b/test/lib/01-con-discon-success.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect and subsequent disconnect. diff --git a/test/lib/01-keepalive-pingreq.py b/test/lib/01-keepalive-pingreq.py index 59129cfe..a58fb45e 100755 --- a/test/lib/01-keepalive-pingreq.py +++ b/test/lib/01-keepalive-pingreq.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a pingreq after the keepalive time diff --git a/test/lib/01-no-clean-session.py b/test/lib/01-no-clean-session.py index 481b1190..29ea42d4 100755 --- a/test/lib/01-no-clean-session.py +++ b/test/lib/01-no-clean-session.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect with clean session not set. diff --git a/test/lib/01-server-keepalive-pingreq.py b/test/lib/01-server-keepalive-pingreq.py index 2d6fa9c2..d375c97c 100755 --- a/test/lib/01-server-keepalive-pingreq.py +++ b/test/lib/01-server-keepalive-pingreq.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a pingreq after the keepalive time # Client sets a keepalive of 60 seconds, but receives a server keepalive to set diff --git a/test/lib/01-unpwd-set.py b/test/lib/01-unpwd-set.py index 6dd0d4d5..6d4ad190 100755 --- a/test/lib/01-unpwd-set.py +++ b/test/lib/01-unpwd-set.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect with a username and password. diff --git a/test/lib/01-will-set.py b/test/lib/01-will-set.py index c43f1f08..af9ae789 100755 --- a/test/lib/01-will-set.py +++ b/test/lib/01-will-set.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect with a will. # Will QoS=1, will retain=1. @@ -13,7 +13,7 @@ port = mosq_test.get_lib_port() rc = 1 keepalive = 60 -connect_packet = mosq_test.gen_connect("01-will-set", keepalive=keepalive, will_topic="topic/on/unexpected/disconnect", will_qos=1, will_retain=True, will_payload="will message") +connect_packet = mosq_test.gen_connect("01-will-set", keepalive=keepalive, will_topic="topic/on/unexpected/disconnect", will_qos=1, will_retain=True, will_payload=b"will message") sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) diff --git a/test/lib/01-will-unpwd-set.py b/test/lib/01-will-unpwd-set.py index e9132376..534d2670 100755 --- a/test/lib/01-will-unpwd-set.py +++ b/test/lib/01-will-unpwd-set.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect with a will, username and password. @@ -15,7 +15,7 @@ rc = 1 keepalive = 60 connect_packet = mosq_test.gen_connect("01-will-unpwd-set", keepalive=keepalive, username="oibvvwqw", password="#'^2hg9a&nm38*us", - will_topic="will-topic", will_qos=2, will_payload="will message") + will_topic="will-topic", will_qos=2, will_payload=b"will message") sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) diff --git a/test/lib/02-subscribe-qos0.py b/test/lib/02-subscribe-qos0.py index 737efa77..692c6e6e 100755 --- a/test/lib/02-subscribe-qos0.py +++ b/test/lib/02-subscribe-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct SUBSCRIBE to a topic with QoS 0. diff --git a/test/lib/02-subscribe-qos1.py b/test/lib/02-subscribe-qos1.py index 5201bf0e..4e237d51 100755 --- a/test/lib/02-subscribe-qos1.py +++ b/test/lib/02-subscribe-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct SUBSCRIBE to a topic with QoS 1. diff --git a/test/lib/02-subscribe-qos2.py b/test/lib/02-subscribe-qos2.py index 180c3b9d..2c41e359 100755 --- a/test/lib/02-subscribe-qos2.py +++ b/test/lib/02-subscribe-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct SUBSCRIBE to a topic with QoS 2. diff --git a/test/lib/02-unsubscribe-multiple-v5.py b/test/lib/02-unsubscribe-multiple-v5.py index af564e6a..ab50b93a 100755 --- a/test/lib/02-unsubscribe-multiple-v5.py +++ b/test/lib/02-unsubscribe-multiple-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a v5 client sends a correct UNSUBSCRIBE packet with multiple # topics, and handles the UNSUBACK. diff --git a/test/lib/02-unsubscribe-v5.py b/test/lib/02-unsubscribe-v5.py index 9b55d276..32d565ab 100755 --- a/test/lib/02-unsubscribe-v5.py +++ b/test/lib/02-unsubscribe-v5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a v5 client sends a correct UNSUBSCRIBE packet, and handles the UNSUBACK. diff --git a/test/lib/02-unsubscribe.py b/test/lib/02-unsubscribe.py index abffc00a..39aa05bc 100755 --- a/test/lib/02-unsubscribe.py +++ b/test/lib/02-unsubscribe.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct UNSUBSCRIBE packet. diff --git a/test/lib/03-publish-b2c-qos1.py b/test/lib/03-publish-b2c-qos1.py index 942ca4f7..0d01cbe7 100755 --- a/test/lib/03-publish-b2c-qos1.py +++ b/test/lib/03-publish-b2c-qos1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client responds correctly to a PUBLISH with QoS 1. diff --git a/test/lib/03-publish-b2c-qos2-len.py b/test/lib/03-publish-b2c-qos2-len.py index 775669cc..fe379774 100755 --- a/test/lib/03-publish-b2c-qos2-len.py +++ b/test/lib/03-publish-b2c-qos2-len.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether a v5 client handles a v5 PUBREL with all combinations # of with/without reason code and properties. diff --git a/test/lib/03-publish-b2c-qos2.py b/test/lib/03-publish-b2c-qos2.py index 8600c187..32589db7 100755 --- a/test/lib/03-publish-b2c-qos2.py +++ b/test/lib/03-publish-b2c-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client responds correctly to a PUBLISH with QoS 1. diff --git a/test/lib/03-publish-c2b-qos1-disconnect.py b/test/lib/03-publish-c2b-qos1-disconnect.py index 87aa79ba..2900489b 100755 --- a/test/lib/03-publish-c2b-qos1-disconnect.py +++ b/test/lib/03-publish-c2b-qos1-disconnect.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 1, then responds correctly to a disconnect. diff --git a/test/lib/03-publish-c2b-qos1-len.py b/test/lib/03-publish-c2b-qos1-len.py index 30e65337..a3107b3b 100755 --- a/test/lib/03-publish-c2b-qos1-len.py +++ b/test/lib/03-publish-c2b-qos1-len.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether a v5 client handles a v5 PUBACK with all combinations # of with/without reason code and properties. diff --git a/test/lib/03-publish-c2b-qos1-receive-maximum.py b/test/lib/03-publish-c2b-qos1-receive-maximum.py index b55860ea..8a09e5e8 100755 --- a/test/lib/03-publish-c2b-qos1-receive-maximum.py +++ b/test/lib/03-publish-c2b-qos1-receive-maximum.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client responds correctly to multiple PUBLISH with QoS 1, with # receive maximum set to 3. diff --git a/test/lib/03-publish-c2b-qos1-timeout.py b/test/lib/03-publish-c2b-qos1-timeout.py index 104961aa..73889ce0 100755 --- a/test/lib/03-publish-c2b-qos1-timeout.py +++ b/test/lib/03-publish-c2b-qos1-timeout.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 1 and responds to a delay. diff --git a/test/lib/03-publish-c2b-qos2-disconnect.py b/test/lib/03-publish-c2b-qos2-disconnect.py index dbd843db..ee8ed3cb 100755 --- a/test/lib/03-publish-c2b-qos2-disconnect.py +++ b/test/lib/03-publish-c2b-qos2-disconnect.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 2 and responds to a disconnect. diff --git a/test/lib/03-publish-c2b-qos2-len.py b/test/lib/03-publish-c2b-qos2-len.py index fc444167..12fd27af 100755 --- a/test/lib/03-publish-c2b-qos2-len.py +++ b/test/lib/03-publish-c2b-qos2-len.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Check whether a v5 client handles a v5 PUBREC, PUBCOMP with all combinations # of with/without reason code and properties. diff --git a/test/lib/03-publish-c2b-qos2-maximum-qos-0.py b/test/lib/03-publish-c2b-qos2-maximum-qos-0.py index 430df3a2..224b85a0 100755 --- a/test/lib/03-publish-c2b-qos2-maximum-qos-0.py +++ b/test/lib/03-publish-c2b-qos2-maximum-qos-0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client correctly handles sending a message with QoS > maximum QoS. diff --git a/test/lib/03-publish-c2b-qos2-maximum-qos-1.py b/test/lib/03-publish-c2b-qos2-maximum-qos-1.py index ec29af36..b93cab05 100755 --- a/test/lib/03-publish-c2b-qos2-maximum-qos-1.py +++ b/test/lib/03-publish-c2b-qos2-maximum-qos-1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client correctly handles sending a message with QoS > maximum QoS. diff --git a/test/lib/03-publish-c2b-qos2-pubrec-error.py b/test/lib/03-publish-c2b-qos2-pubrec-error.py index 58021bd4..67c7a872 100755 --- a/test/lib/03-publish-c2b-qos2-pubrec-error.py +++ b/test/lib/03-publish-c2b-qos2-pubrec-error.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client responds correctly when sending multiple PUBLISH with # QoS 2, with the broker rejecting the first PUBLISH by setting the reason code diff --git a/test/lib/03-publish-c2b-qos2-receive-maximum-1.py b/test/lib/03-publish-c2b-qos2-receive-maximum-1.py index cb27cf55..c56c7071 100755 --- a/test/lib/03-publish-c2b-qos2-receive-maximum-1.py +++ b/test/lib/03-publish-c2b-qos2-receive-maximum-1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client responds correctly to multiple PUBLISH with QoS 2, with # receive maximum set to 1. diff --git a/test/lib/03-publish-c2b-qos2-receive-maximum-2.py b/test/lib/03-publish-c2b-qos2-receive-maximum-2.py index b2335a51..2859cb53 100755 --- a/test/lib/03-publish-c2b-qos2-receive-maximum-2.py +++ b/test/lib/03-publish-c2b-qos2-receive-maximum-2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client responds correctly to multiple PUBLISH with QoS 2, with # receive maximum set to 2. diff --git a/test/lib/03-publish-c2b-qos2-timeout.py b/test/lib/03-publish-c2b-qos2-timeout.py index 68313423..8cd785fd 100755 --- a/test/lib/03-publish-c2b-qos2-timeout.py +++ b/test/lib/03-publish-c2b-qos2-timeout.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 1 and responds to a delay. diff --git a/test/lib/03-publish-c2b-qos2.py b/test/lib/03-publish-c2b-qos2.py index 3a52b767..24cdc66c 100755 --- a/test/lib/03-publish-c2b-qos2.py +++ b/test/lib/03-publish-c2b-qos2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 2. diff --git a/test/lib/03-publish-qos0-no-payload.py b/test/lib/03-publish-qos0-no-payload.py index 4a851d62..437ec906 100755 --- a/test/lib/03-publish-qos0-no-payload.py +++ b/test/lib/03-publish-qos0-no-payload.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 0 and no payload. diff --git a/test/lib/03-publish-qos0.py b/test/lib/03-publish-qos0.py index dff2cb81..9af5b867 100755 --- a/test/lib/03-publish-qos0.py +++ b/test/lib/03-publish-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 0. diff --git a/test/lib/03-request-response-correlation.py b/test/lib/03-request-response-correlation.py index 689ddcfc..01a297f4 100755 --- a/test/lib/03-request-response-correlation.py +++ b/test/lib/03-request-response-correlation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/lib/03-request-response.py b/test/lib/03-request-response.py index fe0bf456..00c7d763 100755 --- a/test/lib/03-request-response.py +++ b/test/lib/03-request-response.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/lib/04-retain-qos0.py b/test/lib/04-retain-qos0.py index 485d7712..117a2f50 100755 --- a/test/lib/04-retain-qos0.py +++ b/test/lib/04-retain-qos0.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct retained PUBLISH to a topic with QoS 0. diff --git a/test/lib/08-ssl-bad-cacert.py b/test/lib/08-ssl-bad-cacert.py index 025f66b9..e223a5fb 100755 --- a/test/lib/08-ssl-bad-cacert.py +++ b/test/lib/08-ssl-bad-cacert.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/lib/08-ssl-connect-cert-auth-enc.py b/test/lib/08-ssl-connect-cert-auth-enc.py index ffe246b4..ef84dea2 100755 --- a/test/lib/08-ssl-connect-cert-auth-enc.py +++ b/test/lib/08-ssl-connect-cert-auth-enc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect and subsequent disconnect when using SSL. # Client must provide a certificate. diff --git a/test/lib/08-ssl-connect-cert-auth.py b/test/lib/08-ssl-connect-cert-auth.py index ef51a88a..4e1dfd6b 100755 --- a/test/lib/08-ssl-connect-cert-auth.py +++ b/test/lib/08-ssl-connect-cert-auth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect and subsequent disconnect when using SSL. # Client must provide a certificate. diff --git a/test/lib/08-ssl-connect-no-auth.py b/test/lib/08-ssl-connect-no-auth.py index 089ad330..dd3215b1 100755 --- a/test/lib/08-ssl-connect-no-auth.py +++ b/test/lib/08-ssl-connect-no-auth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client produces a correct connect and subsequent disconnect when using SSL. diff --git a/test/lib/08-ssl-fake-cacert.py b/test/lib/08-ssl-fake-cacert.py index 3d066763..cb61b63e 100755 --- a/test/lib/08-ssl-fake-cacert.py +++ b/test/lib/08-ssl-fake-cacert.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/lib/09-util-topic-tokenise.py b/test/lib/09-util-topic-tokenise.py index 88974c2e..dc9ec36b 100755 --- a/test/lib/09-util-topic-tokenise.py +++ b/test/lib/09-util-topic-tokenise.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/lib/11-prop-oversize-packet.py b/test/lib/11-prop-oversize-packet.py index 946b7139..8151ff37 100755 --- a/test/lib/11-prop-oversize-packet.py +++ b/test/lib/11-prop-oversize-packet.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client publishing an oversize packet correctly. # The client should try to publish a message that is too big, then the one below which is ok. diff --git a/test/lib/11-prop-send-content-type.py b/test/lib/11-prop-send-content-type.py index 9a433f1c..dddbfe31 100755 --- a/test/lib/11-prop-send-content-type.py +++ b/test/lib/11-prop-send-content-type.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mosq_test_helper import * diff --git a/test/lib/11-prop-send-payload-format.py b/test/lib/11-prop-send-payload-format.py index 701d55ba..6a826370 100755 --- a/test/lib/11-prop-send-payload-format.py +++ b/test/lib/11-prop-send-payload-format.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Test whether a client sends a correct PUBLISH to a topic with QoS 0. diff --git a/test/mosq_test.py b/test/mosq_test.py index 6c039619..fc2289c6 100644 --- a/test/mosq_test.py +++ b/test/mosq_test.py @@ -315,7 +315,7 @@ def to_string(packet): # Reserved return "0xF0" -def gen_connect(client_id, clean_session=True, keepalive=60, username=None, password=None, will_topic=None, will_qos=0, will_retain=False, will_payload="", proto_ver=4, connect_reserved=False, properties="", will_properties=""): +def gen_connect(client_id, clean_session=True, keepalive=60, username=None, password=None, will_topic=None, will_qos=0, will_retain=False, will_payload=b"", proto_ver=4, connect_reserved=False, properties=b"", will_properties=b""): if (proto_ver&0x7F) == 3 or proto_ver == 0: remaining_length = 12 elif (proto_ver&0x7F) == 4 or proto_ver == 5: @@ -324,6 +324,7 @@ def gen_connect(client_id, clean_session=True, keepalive=60, username=None, pass raise ValueError if client_id != None: + client_id = client_id.encode("utf-8") remaining_length = remaining_length + 2+len(client_id) else: remaining_length = remaining_length + 2 @@ -337,12 +338,13 @@ def gen_connect(client_id, clean_session=True, keepalive=60, username=None, pass connect_flags = connect_flags | 0x02 if proto_ver == 5: - if properties == "": + if properties == b"": properties += mqtt5_props.gen_uint16_prop(mqtt5_props.PROP_RECEIVE_MAXIMUM, 20) properties = mqtt5_props.prop_finalise(properties) remaining_length += len(properties) if will_topic != None: + will_topic = will_topic.encode("utf-8") remaining_length = remaining_length + 2+len(will_topic) + 2+len(will_payload) connect_flags = connect_flags | 0x04 | ((will_qos&0x03) << 3) if will_retain: @@ -352,24 +354,26 @@ def gen_connect(client_id, clean_session=True, keepalive=60, username=None, pass remaining_length += len(will_properties) if username != None: + username = username.encode("utf-8") remaining_length = remaining_length + 2+len(username) connect_flags = connect_flags | 0x80 if password != None: + password = password.encode("utf-8") connect_flags = connect_flags | 0x40 remaining_length = remaining_length + 2+len(password) rl = pack_remaining_length(remaining_length) packet = struct.pack("!B"+str(len(rl))+"s", 0x10, rl) if (proto_ver&0x7F) == 3 or proto_ver == 0: - packet = packet + struct.pack("!H6sBBH", len("MQIsdp"), "MQIsdp", proto_ver, connect_flags, keepalive) + packet = packet + struct.pack("!H6sBBH", len(b"MQIsdp"), b"MQIsdp", proto_ver, connect_flags, keepalive) elif (proto_ver&0x7F) == 4 or proto_ver == 5: - packet = packet + struct.pack("!H4sBBH", len("MQTT"), "MQTT", proto_ver, connect_flags, keepalive) + packet = packet + struct.pack("!H4sBBH", len(b"MQTT"), b"MQTT", proto_ver, connect_flags, keepalive) if proto_ver == 5: packet += properties if client_id != None: - packet = packet + struct.pack("!H"+str(len(client_id))+"s", len(client_id), client_id) + packet = packet + struct.pack("!H"+str(len(client_id))+"s", len(client_id), bytes(client_id)) else: packet = packet + struct.pack("!H", 0) @@ -387,12 +391,12 @@ def gen_connect(client_id, clean_session=True, keepalive=60, username=None, pass packet = packet + struct.pack("!H"+str(len(password))+"s", len(password), password) return packet -def gen_connack(flags=0, rc=0, proto_ver=4, properties=""): +def gen_connack(flags=0, rc=0, proto_ver=4, properties=b""): if proto_ver == 5: if properties is not None: properties = mqtt5_props.gen_uint16_prop(mqtt5_props.PROP_TOPIC_ALIAS_MAXIMUM, 10) + properties else: - properties = "" + properties = b"" properties = mqtt5_props.prop_finalise(properties) packet = struct.pack('!BBBB', 32, 2+len(properties), flags, rc) + properties @@ -401,7 +405,8 @@ def gen_connack(flags=0, rc=0, proto_ver=4, properties=""): return packet -def gen_publish(topic, qos, payload=None, retain=False, dup=False, mid=0, proto_ver=4, properties=""): +def gen_publish(topic, qos, payload=None, retain=False, dup=False, mid=0, proto_ver=4, properties=b""): + topic = topic.encode("utf-8") rl = 2+len(topic) pack_format = "H"+str(len(topic))+"s" if qos > 0: @@ -415,10 +420,11 @@ def gen_publish(topic, qos, payload=None, retain=False, dup=False, mid=0, proto_ pack_format = pack_format + "%ds"%(len(properties)) if payload != None: + payload = payload.encode("utf-8") rl = rl + len(payload) pack_format = pack_format + str(len(payload))+"s" else: - payload = "" + payload = b"" pack_format = pack_format + "0s" rlpacked = pack_remaining_length(rl) @@ -471,9 +477,10 @@ def gen_pubrel(mid, dup=False, proto_ver=4, reason_code=-1, properties=None): def gen_pubcomp(mid, proto_ver=4, reason_code=-1, properties=None): return _gen_command_with_mid(112, mid, proto_ver, reason_code, properties) -def gen_subscribe(mid, topic, qos, proto_ver=4, properties=""): +def gen_subscribe(mid, topic, qos, proto_ver=4, properties=b""): + topic = topic.encode("utf-8") if proto_ver == 5: - if properties == "": + if properties == b"": pack_format = "!BBHBH"+str(len(topic))+"sB" return struct.pack(pack_format, 130, 2+1+2+len(topic)+1, mid, 0, len(topic), topic, qos) else: @@ -491,6 +498,7 @@ def gen_suback(mid, qos, proto_ver=4): return struct.pack('!BBHB', 144, 2+1, mid, qos) def gen_unsubscribe(mid, topic, proto_ver=4): + topic = topic.encode("utf-8") if proto_ver == 5: pack_format = "!BBHBH"+str(len(topic))+"s" return struct.pack(pack_format, 162, 2+2+len(topic)+1, mid, 0, len(topic), topic) @@ -499,9 +507,10 @@ def gen_unsubscribe(mid, topic, proto_ver=4): return struct.pack(pack_format, 162, 2+2+len(topic), mid, len(topic), topic) def gen_unsubscribe_multiple(mid, topics, proto_ver=4): - packet = "" + packet = b"" remaining_length = 0 for t in topics: + t = t.encode("utf-8") remaining_length += 2+len(t) packet += struct.pack("!H"+str(len(t))+"s", len(t), t) @@ -549,7 +558,7 @@ def gen_disconnect(reason_code=-1, proto_ver=4, properties=None): return struct.pack('!BB', 224, 0) def pack_remaining_length(remaining_length): - s = "" + s = b"" while True: byte = remaining_length % 128 remaining_length = remaining_length // 128 diff --git a/test/mqtt5_props.py b/test/mqtt5_props.py index 9f307324..9f6ad4bc 100644 --- a/test/mqtt5_props.py +++ b/test/mqtt5_props.py @@ -41,10 +41,13 @@ def gen_uint32_prop(identifier, word): return prop def gen_string_prop(identifier, s): + s = s.encode("utf-8") prop = struct.pack('!BH%ds'%(len(s)), identifier, len(s), s) return prop def gen_string_pair_prop(identifier, s1, s2): + s1 = s1.encode("utf-8") + s2 = s2.encode("utf-8") prop = struct.pack('!BH%dsH%ds'%(len(s1), len(s2)), identifier, len(s1), s1, len(s2), s2) return prop @@ -53,7 +56,7 @@ def gen_varint_prop(identifier, val): return struct.pack("!B"+str(len(v))+"s", identifier, v) def pack_varint(varint): - s = "" + s = b"" while True: byte = varint % 128 varint = varint // 128