mirror of
https://github.com/status-im/status-python-sdk.git
synced 2026-08-31 06:01:19 +00:00
- 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
21 lines
973 B
Python
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")
|