From ae048a91d26d43b1f77393b2c2384c7d084166ff Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 31 Oct 2019 17:13:56 +0100 Subject: [PATCH] Test MonitoringService deployment with zero SR If ServiceRegistry address is zero, MonitoringService's constructor is supposed to fail. This commit adds a test for this behavior. --- .../tests/test_monitoring_service.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/raiden_contracts/tests/test_monitoring_service.py b/raiden_contracts/tests/test_monitoring_service.py index f55af74ea..1f9ddd786 100644 --- a/raiden_contracts/tests/test_monitoring_service.py +++ b/raiden_contracts/tests/test_monitoring_service.py @@ -442,3 +442,22 @@ def test_monitoring_service_deploy_with_token_address_zero( _udc_address=uninitialized_user_deposit_contract.address, _token_network_registry_address=token_network_registry_contract.address, ) + + +def test_monitoring_service_deploy_with_service_registry_zero( + deploy_tester_contract: Callable, + custom_token: Contract, + uninitialized_user_deposit_contract: Contract, + token_network_registry_contract: Contract, +) -> None: + # No good error message is available due to + # https://github.com/raiden-network/raiden-contracts/issues/1329 + # with pytest.raises(TransactionFailed, match="ServiceRegistry at address zero"): + with pytest.raises(TransactionFailed): + deploy_tester_contract( + contract_name=CONTRACT_MONITORING_SERVICE, + _token_address=custom_token.address, + _service_registry_address=EMPTY_HEXADDRESS, + _udc_address=uninitialized_user_deposit_contract.address, + _token_network_registry_address=token_network_registry_contract.address, + )