Adjust some tests to use the free gas strategy by name, instead of a callable

pull/2445/head
David Núñez 2020-12-20 21:53:36 +01:00
parent 6e06c2228f
commit d9d21f7cfb
3 changed files with 13 additions and 3 deletions

View File

@ -24,6 +24,9 @@ from nucypher.crypto.powers import TransactingPower
from tests.constants import INSECURE_DEVELOPMENT_PASSWORD
from tests.utils.blockchain import free_gas_price_strategy
BlockchainDeployerInterface.GAS_STRATEGIES = {**BlockchainDeployerInterface.GAS_STRATEGIES,
'free': free_gas_price_strategy}
def test_deployer_interface_multiversion_contract():
@ -42,7 +45,7 @@ def test_deployer_interface_multiversion_contract():
# Prepare chain
BlockchainInterfaceFactory._interfaces.clear()
blockchain_interface = BlockchainDeployerInterface(provider_uri='tester://pyevm',
gas_strategy=free_gas_price_strategy)
gas_strategy='free')
blockchain_interface.connect()
BlockchainInterfaceFactory.register_interface(interface=blockchain_interface) # Lets this test run in isolation

View File

@ -104,8 +104,11 @@ def test_multiversion_contract():
compiled_contracts = multiversion_compile(source_bundles=bundles)
# Prepare chain
BlockchainDeployerInterface.GAS_STRATEGIES = {**BlockchainDeployerInterface.GAS_STRATEGIES,
'free': free_gas_price_strategy}
blockchain_interface = BlockchainDeployerInterface(provider_uri='tester://pyevm/2',
gas_strategy=free_gas_price_strategy)
gas_strategy='free')
blockchain_interface.connect(compile_now=False)
blockchain_interface._raw_contract_cache = compiled_contracts

View File

@ -39,6 +39,10 @@ BRANCH = "main"
GITHUB_SOURCE_LINK = f"https://api.github.com/repos/{USER}/{REPO}/contents/nucypher/blockchain/eth/sol/source?ref={BRANCH}"
BlockchainDeployerInterface.GAS_STRATEGIES = {**BlockchainDeployerInterface.GAS_STRATEGIES,
'free': free_gas_price_strategy}
def download_github_dir(source_link: str, target_folder: str):
response = requests.get(source_link)
if response.status_code != 200:
@ -110,7 +114,7 @@ def test_upgradeability(temp_dir_path):
provider_uri = 'tester://pyevm/2' # TODO: Testerchain caching Issues
try:
blockchain_interface = BlockchainDeployerInterface(provider_uri=provider_uri,
gas_strategy=free_gas_price_strategy)
gas_strategy='free')
blockchain_interface.connect()
origin = blockchain_interface.client.accounts[0]
BlockchainInterfaceFactory.register_interface(interface=blockchain_interface)