mosquitto/test/client/03-publish-argv-errors-tls-psk.py

23 lines
848 B
Python
Raw Normal View History

#!/usr/bin/env python3
#
from mosq_test_helper import *
2026-03-11 10:38:59 +01:00
mosq_test.require_features(["WITH_CLIENTS", "WITH_TLS", "WITH_TLS_PSK"])
def do_test(args, stderr_expected, rc_expected):
2026-04-27 10:14:13 +02:00
client_run(mosq_paths.mosquitto_pub, args, stderr_expected, rc_expected)
if __name__ == '__main__':
# Missing args
do_test(['--psk'], "Error: --psk argument given but no key specified.", 1)
do_test(['--psk-identity'], "Error: --psk-identity argument given but no identity specified.", 1)
# Invalid combinations
do_test(['--cafile', 'file', '--psk', 'key'], "Error: Only one of --psk or --cafile/--capath may be used at once.", 1)
do_test(['--capath', 'dir', '--psk', 'key'], "Error: Only one of --psk or --cafile/--capath may be used at once.", 1)
do_test(['--psk', 'key'], "Error: --psk-identity required if --psk used.", 1)