Skip to content

Commit 6499e3e

Browse files
Fix
1 parent 62c604b commit 6499e3e

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

cdp/user_operation.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def __repr__(self) -> str:
4141
"""Return a string representation of the Status."""
4242
return str(self)
4343

44+
def __eq__(self, other):
45+
if isinstance(other, str):
46+
return self.value == other
47+
return super().__eq__(other)
48+
4449
def __init__(self, model: UserOperationModel, smart_wallet_address: str) -> None:
4550
"""Initialize the UserOperation class.
4651

tests/factories/api_key_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def dummy_key_factory():
1212
- "ed25519-32": Returns a base64-encoded 32-byte Ed25519 private key.
1313
- "ed25519-64": Returns a base64-encoded 64-byte dummy Ed25519 key (the first 32 bytes will be used).
1414
"""
15+
1516
def _create_dummy(key_type: str = "ecdsa") -> str:
1617
if key_type == "ecdsa":
1718
return (
@@ -25,9 +26,10 @@ def _create_dummy(key_type: str = "ecdsa") -> str:
2526
return "BXyKC+eFINc/6ztE/3neSaPGgeiU9aDRpaDnAbaA/vyTrUNgtuh/1oX6Vp+OEObV3SLWF+OkF2EQNPtpl0pbfA=="
2627
elif key_type == "ed25519-64":
2728
# Create a 64-byte dummy by concatenating a 32-byte sequence with itself.
28-
dummy_32 = b'\x01' * 32
29+
dummy_32 = b"\x01" * 32
2930
dummy_64 = dummy_32 + dummy_32
3031
return base64.b64encode(dummy_64).decode("utf-8")
3132
else:
3233
raise ValueError("Unsupported key type for dummy key creation")
34+
3335
return _create_dummy

tests/test_api_key_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ def test_parse_private_key_pem_ec(dummy_key_factory):
1010
parsed_key = _parse_private_key(dummy_key)
1111
assert isinstance(parsed_key, ec.EllipticCurvePrivateKey)
1212

13+
1314
def test_parse_private_key_ed25519_32(dummy_key_factory):
1415
"""Test that a base64-encoded 32-byte Ed25519 key is parsed correctly using a dummy key from the factory."""
1516
dummy_key = dummy_key_factory("ed25519-32")
1617
parsed_key = _parse_private_key(dummy_key)
1718
assert isinstance(parsed_key, ed25519.Ed25519PrivateKey)
1819

20+
1921
def test_parse_private_key_ed25519_64(dummy_key_factory):
2022
"""Test that a base64-encoded 64-byte input is parsed correctly by taking the first 32 bytes using a dummy key from the factory."""
2123
dummy_key = dummy_key_factory("ed25519-64")
2224
parsed_key = _parse_private_key(dummy_key)
2325
assert isinstance(parsed_key, ed25519.Ed25519PrivateKey)
2426

27+
2528
def test_parse_private_key_invalid():
2629
"""Test that an invalid key string raises a ValueError."""
2730
with pytest.raises(ValueError, match="Could not parse the private key"):

0 commit comments

Comments
 (0)