[7.x] Implement 'arbitrary_key' feature for REST API tests

Co-authored-by: P. Sai Vinay <[email protected]>
This commit is contained in:
Seth Michael Larson
2021-01-25 09:36:15 -06:00
committed by GitHub
co-authored by P. Sai Vinay
parent 42752953ec
commit ca0db1a426
@@ -51,6 +51,7 @@ IMPLEMENTED_FEATURES = {
"warnings",
"allowed_warnings",
"contains",
"arbitrary_key",
}
# broken YAML tests on some releases
@@ -314,6 +315,8 @@ class YamlRunner:
step = int(step)
assert isinstance(value, list)
assert len(value) > step
elif step == "_arbitrary_key_":
return list(value.keys())[0]
else:
assert step in value
value = value[step]