summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/kmstest.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/kmstest.py b/tests/kmstest.py
index 3e53def..a932bc8 100755
--- a/tests/kmstest.py
+++ b/tests/kmstest.py
@@ -275,8 +275,20 @@ class AtomicRequest(pykms.AtomicReq):
min, max = prop.values
v = min + int((max - min) * int(v[:-1]) / 100)
- else:
+ elif v.isnumeric():
v = int(v)
+ else:
+ prop = obj.get_prop(k)
+ if not prop:
+ raise RuntimeError(f'Property {k} not supported by object {obj}')
+ if prop.type != pykms.PropertyType.Enum:
+ raise RuntimeError(f'Unsupported property type {prop.type} for value {v}')
+ for value, name in prop.enums.items():
+ if name == v:
+ v = value
+ break
+ else:
+ raise RuntimeError(f'Enum value with name "{v}" not found in property {k}')
if not isinstance(v, int):
raise RuntimeError(f'Unsupported value type {type(v)} for property {k}')