Skip to content

Commit

Permalink
Cover the case contract_name is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
pirapira committed Oct 31, 2019
1 parent 84aaac0 commit 7e730f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions raiden_contracts/contract_source_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
6 changes: 6 additions & 0 deletions raiden_contracts/tests/test_contracts_compilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ContractSourceManager,
ContractSourceManagerVerificationError,
contracts_source_path,
verify_single_precompiled_checksum_on_nonexistent_contract_name,
)


Expand Down Expand Up @@ -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()

0 comments on commit 7e730f6

Please sign in to comment.