Skip to content

Commit b06ea37

Browse files
authored
Do value replacement for both ${...} and $... in strings
1 parent bdbbde9 commit b06ea37

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test_elasticsearch/test_server/test_rest_api_spec.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ def _resolve(self, value):
407407
):
408408
value = value.replace(key_replace, str(v))
409409
break
410+
# We only do the in-string replacement if value is JSON string
411+
# E.g. '{\n "password_hash" : "$hash"\n}\n'
412+
elif (
413+
key_replace.startswith("$")
414+
and isinstance(value, string_types)
415+
and key_replace in value
416+
and not value.startswith("$")
417+
):
418+
value = value.replace(key_replace, str(v))
419+
break
410420

411421
if isinstance(value, string_types):
412422
value = value.strip()

0 commit comments

Comments
 (0)