Integration tests can test insecure communications with broker

This commit is contained in:
bj
2020-10-16 10:57:38 +02:00
parent e061b64ec1
commit 985d373b74
9 changed files with 115 additions and 52 deletions
+4 -7
View File
@@ -14,7 +14,7 @@ def update_client_record(client, userdata, message):
database_blank.write("{}")
with open(database_file, 'r') as infile:
database = json.load(infile)
database = json.loads(infile.read())
payload = message.payload.decode('utf-8')
response = json.loads(payload)
@@ -25,13 +25,10 @@ def update_client_record(client, userdata, message):
json.dump(database, outfile)
def subscribe(broker_hostname, broker_port, topic="torch", ca_file=None, cert_file=None, key_file=None):
def subscribe(broker_hostname, broker_port, topic="torch", tls=None, auth=None):
mqtt.callback(update_client_record,
topic,
hostname=broker_hostname,
port=broker_port,
tls={
'ca_certs': ca_file,
'certfile': cert_file,
'keyfile': key_file
})
tls=tls,
auth=auth)