-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Closes #785
- Loading branch information
Showing
4 changed files
with
222 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 19 additions & 4 deletions
23
gnosis/eth/tests/account_abstraction/test_user_operation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
from unittest import TestCase | ||
|
||
from ...account_abstraction import UserOperation | ||
from ...account_abstraction.user_operation import UserOperationV07 | ||
from ..mocks.mock_bundler import ( | ||
safe_4337_chain_id_mock, | ||
safe_4337_user_operation_hash_mock, | ||
user_operation_mock, | ||
user_operation_v07_hash, | ||
user_operation_v07_mock, | ||
) | ||
|
||
|
||
class TestUserOperation(TestCase): | ||
def test_calculate_user_operation_hash(self): | ||
user_operation_hash = safe_4337_user_operation_hash_mock.hex() | ||
def test_calculate_user_operation_hash_V06(self): | ||
user_operation_hash = safe_4337_user_operation_hash_mock | ||
user_operation = UserOperation.from_bundler_response( | ||
user_operation_hash, user_operation_mock["result"] | ||
user_operation_hash.hex(), user_operation_mock["result"] | ||
) | ||
self.assertIsInstance(user_operation, UserOperation) | ||
self.assertEqual( | ||
user_operation.calculate_user_operation_hash(safe_4337_chain_id_mock), | ||
safe_4337_user_operation_hash_mock, | ||
user_operation_hash, | ||
) | ||
|
||
def test_calculate_user_operation_hash_V07(self): | ||
user_operation_hash = user_operation_v07_hash | ||
user_operation = UserOperation.from_bundler_response( | ||
user_operation_hash.hex(), user_operation_v07_mock["result"] | ||
) | ||
self.assertIsInstance(user_operation, UserOperationV07) | ||
self.assertEqual( | ||
user_operation.calculate_user_operation_hash(safe_4337_chain_id_mock), | ||
user_operation_hash, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters