diff --git a/raiden_contracts/contract_source_manager.py b/raiden_contracts/contract_source_manager.py index c810bc8ee..cbaa60902 100644 --- a/raiden_contracts/contract_source_manager.py +++ b/raiden_contracts/contract_source_manager.py @@ -197,3 +197,10 @@ def _verify_single_precompiled_checksum( f"checksum of {contract_name} does not match. got {precompiled_checksum} != " "expected {expected_checksum}" ) + + +def verify_single_precompiled_checksum_on_nonexistent_contract_name() -> None: + """ A functiohn for testing the case where the contract name is not found """ + _verify_single_precompiled_checksum( + checked_checksums={}, contract_name="a", expected_checksum="abc" + ) diff --git a/raiden_contracts/tests/test_contracts_compilation.py b/raiden_contracts/tests/test_contracts_compilation.py index 6d4e3fa2c..aa455b98c 100644 --- a/raiden_contracts/tests/test_contracts_compilation.py +++ b/raiden_contracts/tests/test_contracts_compilation.py @@ -22,6 +22,7 @@ ContractSourceManager, ContractSourceManagerVerificationError, contracts_source_path, + verify_single_precompiled_checksum_on_nonexistent_contract_name, ) @@ -256,3 +257,8 @@ def test_contract_source_manager_constructor_with_wrong_type() -> None: """ ConstructSourceManager's constructor raises TypeError on a wrong kind of argument """ with pytest.raises(TypeError): ContractSourceManager(None) # type: ignore + + +def test_verify_single_precompiled_cyhecksum_on_nonexistent_contract_name() -> None: + with pytest.raises(ContractSourceManagerVerificationError, match="No checksum for"): + verify_single_precompiled_checksum_on_nonexistent_contract_name()