Files
status-python-sdk/resources/utils.py
T
Nick Ninov 0491c597f7 create_account: store credentials locally
- Initial documentation with how to run the project
- Store `create_account_and_login` credentials locally so they can be reused when messaging
- Script can be ran with arguments
2026-02-24 21:46:56 +02:00

21 lines
973 B
Python

def assert_response_attributes(actual, expected, keys=None):
"""
Assert that all keys in expected (or in keys) match in actual.
Handles both list-of-dicts and dict.
"""
if isinstance(expected, list):
assert isinstance(actual, list), "Expected a list for actual"
assert len(actual) == len(expected), "Length mismatch"
for idx, exp in enumerate(expected):
act = actual[idx]
check_keys = keys or exp.keys()
for key in check_keys:
assert act[key] == exp[key], f"Mismatch for key '{key}': {act[key]} != {exp[key]}"
elif isinstance(expected, dict):
assert isinstance(actual, dict), "Expected a dict for actual"
check_keys = keys or expected.keys()
for key in check_keys:
assert actual[key] == expected[key], f"Mismatch for key '{key}': {actual.get(key)} != {expected[key]}"
else:
raise TypeError("Expected must be a list or dict")