Skip to content

Commit 7e730f6

Browse files
Yoichi Hiraipirapira
authored andcommitted
Cover the case contract_name is not found
1 parent 84aaac0 commit 7e730f6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

raiden_contracts/contract_source_manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,10 @@ def _verify_single_precompiled_checksum(
197197
f"checksum of {contract_name} does not match. got {precompiled_checksum} != "
198198
"expected {expected_checksum}"
199199
)
200+
201+
202+
def verify_single_precompiled_checksum_on_nonexistent_contract_name() -> None:
203+
""" A functiohn for testing the case where the contract name is not found """
204+
_verify_single_precompiled_checksum(
205+
checked_checksums={}, contract_name="a", expected_checksum="abc"
206+
)

raiden_contracts/tests/test_contracts_compilation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
ContractSourceManager,
2323
ContractSourceManagerVerificationError,
2424
contracts_source_path,
25+
verify_single_precompiled_checksum_on_nonexistent_contract_name,
2526
)
2627

2728

@@ -256,3 +257,8 @@ def test_contract_source_manager_constructor_with_wrong_type() -> None:
256257
""" ConstructSourceManager's constructor raises TypeError on a wrong kind of argument """
257258
with pytest.raises(TypeError):
258259
ContractSourceManager(None) # type: ignore
260+
261+
262+
def test_verify_single_precompiled_cyhecksum_on_nonexistent_contract_name() -> None:
263+
with pytest.raises(ContractSourceManagerVerificationError, match="No checksum for"):
264+
verify_single_precompiled_checksum_on_nonexistent_contract_name()

0 commit comments

Comments
 (0)