From 7464cab5638d3033ccbbe0bd887e5c391e732398 Mon Sep 17 00:00:00 2001 From: octathorp Date: Sat, 18 Nov 2023 17:04:08 +0100 Subject: [PATCH] #863 verify_response_with fix (#864) --- example/mqtt/testing_utils.py | 2 +- tavern/response.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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)