diff --git a/example/mqtt/testing_utils.py b/example/mqtt/testing_utils.py index f483ca94..d564d6f4 100644 --- a/example/mqtt/testing_utils.py +++ b/example/mqtt/testing_utils.py @@ -1,6 +1,6 @@ def message_says_hello(msg): """Make sure that the response was friendly""" - assert msg.payload.get("message") == "hello world" + assert msg.msg.payload.get("message") == "hello world" def return_hello(_=None): diff --git a/tavern/response.py b/tavern/response.py index 8bee7a6a..9b3b8a58 100644 --- a/tavern/response.py +++ b/tavern/response.py @@ -131,7 +131,11 @@ def check_ext_functions(verify_block): "Badly formatted 'verify_response_with' block" ) - check_ext_functions(response_block.get("verify_response_with", None)) + if mqtt_responses := response_block.get("mqtt_responses"): + for mqtt_response in mqtt_responses: + check_ext_functions(mqtt_response.get("verify_response_with", None)) + else: + check_ext_functions(response_block.get("verify_response_with", None)) def check_deprecated_validate(name): nfuncs = len(self.validate_functions)