Handle json and 2 year certs #53

Merged
bmartin5692 merged 5 commits from ozmo950 into master 2019-10-06 22:48:50 +02:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit 5ac6663502 - Show all commits

View file

@ -183,12 +183,12 @@ class MQTTHelperBot:
cmdjson["payloadType"], cmdjson["payloadType"],
) )
try: try:
if cmdjson["toType"] == "x": if cmdjson["payloadType"] == "x":
await self.Client.publish( await self.Client.publish(
ttopic, str(cmdjson["payload"]).encode(), QOS_0 ttopic, str(cmdjson["payload"]).encode(), QOS_0
) )
if cmdjson["toType"] == "j": if cmdjson["payloadType"] == "j":
await self.Client.publish( await self.Client.publish(
ttopic, json.dumps(cmdjson["payload"]).encode(), QOS_0 ttopic, json.dumps(cmdjson["payload"]).encode(), QOS_0
) )

View file

@ -348,9 +348,8 @@ async def test_helperbot_sendcommand():
0.2 0.2
) # Override wait_resp_timeout (so we don't wait 10 seconds for timeout) ) # Override wait_resp_timeout (so we don't wait 10 seconds for timeout)
# Send response beforehand # Send response beforehand
msg_payload = ( msg_payload = '{"body":{"code":0,"data":{"area":0,"cid":"111","start":"1569378657","time":6,"type":"auto"},"msg":"ok"},"header":{"fwVer":"1.6.4","hwVer":"0.1.1","pri":1,"ts":"1569380074036","tzm":480,"ver":"0.0.1"}}'
'{"body":{"code":0,"data":{"area":0,"cid":"111","start":"1569378657","time":6,"type":"auto"},"msg":"ok"},"header":{"fwVer":"1.6.4","hwVer":"0.1.1","pri":1,"ts":"1569380074036","tzm":480,"ver":"0.0.1"}}'
)
msg_topic_name = ( msg_topic_name = (
"iot/p2p/getStats/bot_serial/ls1ok3/wC3g/helper1/bumper/helper1/p/testj/j" "iot/p2p/getStats/bot_serial/ls1ok3/wC3g/helper1/bumper/helper1/p/testj/j"
) )