Allow array indices for assert_json_path()

This commit is contained in:
Roman authored and Roman Hergenreder committed 2025-12-05 12:23:57 +01:00
1 parent a73847454f
commit d89c0ccf64
1 file changed
+3
+3
View File
@@ -135,6 +135,9 @@ def assert_json_path(res, path, value, err=None):
json_data = json.loads(res.text)
for key in filter(None, path.split(".")):
match = re.match(r"\[([0-9]+)\]", key)
if match:
key = int(match[1])
json_data = json_data[key]
if json_data == value: