Testing failed init of StakingEscrowAgent due to contract not deployed

pull/1124/head
David Núñez 2019-07-09 23:20:03 +02:00 committed by Kieran Prasch
parent 72bf708245
commit 6ca6c4cbcc
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
2 changed files with 10 additions and 1 deletions

View File

@ -218,7 +218,7 @@ class EthereumContractRegistry:
raise self.IllegalRegistry(message) raise self.IllegalRegistry(message)
if not contracts: if not contracts:
raise self.UnknownContract(": {}".format(contract_name)) raise self.UnknownContract(contract_name)
if contract_address and len(contracts) > 1: if contract_address and len(contracts) > 1:
m = "Multiple records returned for address {}" m = "Multiple records returned for address {}"

View File

@ -22,10 +22,19 @@ from eth_utils.address import to_checksum_address, is_address
from nucypher.blockchain.eth.agents import StakingEscrowAgent from nucypher.blockchain.eth.agents import StakingEscrowAgent
from nucypher.blockchain.eth.interfaces import BlockchainInterface from nucypher.blockchain.eth.interfaces import BlockchainInterface
from nucypher.blockchain.eth.registry import EthereumContractRegistry
from nucypher.crypto.powers import TransactingPower from nucypher.crypto.powers import TransactingPower
from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD from nucypher.utilities.sandbox.constants import INSECURE_DEVELOPMENT_PASSWORD
@pytest.mark.slow()
def test_unknown_contract(testerchain):
with pytest.raises(EthereumContractRegistry.UnknownContract) as exception:
_staking_agent = StakingEscrowAgent(blockchain=testerchain)
assert exception.value.args[0] == StakingEscrowAgent.registry_contract_name
@pytest.mark.slow() @pytest.mark.slow()
def test_deposit_tokens(testerchain, agency, token_economics): def test_deposit_tokens(testerchain, agency, token_economics):
token_agent, staking_agent, _policy_agent = agency token_agent, staking_agent, _policy_agent = agency