Deprecation of --poa from CLI tests.

pull/1885/head
Kieran Prasch 2020-04-14 12:48:12 -07:00
parent 08708f3d84
commit 56ee8d0de0
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
10 changed files with 44 additions and 65 deletions

View File

@ -1008,7 +1008,7 @@ Successfully claimed WorkLock tokens for {bidder_address}.
You can check that the stake was created correctly by running:
nucypher status stakers --staking-address {bidder_address} --network {network} --provider {provider_uri} --poa
nucypher status stakers --staking-address {bidder_address} --network {network} --provider {provider_uri}
Next Steps for WorkLock Winners
===============================

View File

@ -21,10 +21,10 @@ import os
import socket
import string
import tempfile
import time
from datetime import datetime
from random import SystemRandom
import time
from web3 import Web3
from nucypher.blockchain.eth.token import NU

View File

@ -24,7 +24,7 @@ def test_geth_EIP_191_client_signature_integration(instant_geth_dev_node):
pytest.skip("Do not run Geth nodes in CI")
# Start a geth process
blockchain = BlockchainInterface(provider_process=instant_geth_dev_node)
blockchain = BlockchainInterface(provider_process=instant_geth_dev_node, poa=True)
blockchain.connect()
# Sign a message (RPC) and verify it.
@ -43,7 +43,7 @@ def test_geth_create_new_account(instant_geth_dev_node):
if 'CIRCLECI' in os.environ:
pytest.skip("Do not run Geth nodes in CI")
blockchain = BlockchainInterface(provider_process=instant_geth_dev_node)
blockchain = BlockchainInterface(provider_process=instant_geth_dev_node, poa=True)
blockchain.connect()
new_account = blockchain.client.new_account(password=INSECURE_DEVELOPMENT_PASSWORD)
assert is_checksum_address(new_account)
@ -55,7 +55,7 @@ def test_geth_deployment_integration(instant_geth_dev_node, test_registry):
if 'CIRCLECI' in os.environ:
pytest.skip("Do not run Geth nodes in CI")
blockchain = BlockchainDeployerInterface(provider_process=instant_geth_dev_node)
blockchain = BlockchainDeployerInterface(provider_process=instant_geth_dev_node, poa=True) # always poa here.
BlockchainInterfaceFactory.register_interface(interface=blockchain)
# Make Deployer

View File

@ -55,7 +55,6 @@ def test_nucypher_deploy_contracts(click_runner,
command = ['contracts',
'--registry-outfile', registry_filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--se-test-mode']
user_input = '0\n' + 'Y\n' + 'DEPLOY'
@ -140,8 +139,7 @@ def test_transfer_tokens(click_runner, registry_filepath):
'--target-address', recipient_address,
'--value', 42,
'--registry-infile', registry_filepath,
'--provider', TEST_PROVIDER_URI,
'--poa']
'--provider', TEST_PROVIDER_URI]
user_input = '0\n' + 'Y\n' + 'Y\n'
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
@ -169,7 +167,7 @@ def test_upgrade_contracts(click_runner, registry_filepath, testerchain):
#
cli_action = 'upgrade'
base_command = ('--registry-infile', registry_filepath, '--provider', TEST_PROVIDER_URI, '--poa')
base_command = ('--registry-infile', registry_filepath, '--provider', TEST_PROVIDER_URI)
yes = 'Y\n' # :-)
#
@ -179,16 +177,16 @@ def test_upgrade_contracts(click_runner, registry_filepath, testerchain):
contracts_to_upgrade = ('StakingEscrow', # v1 -> v2
'PolicyManager', # v1 -> v2
'Adjudicator', # v1 -> v2
'StakingInterface', # v1 -> v2
'StakingInterface', # v1 -> v2
'StakingEscrow', # v2 -> v3
'StakingEscrow', # v3 -> v4
'Adjudicator', # v2 -> v3
'PolicyManager', # v2 -> v3
'StakingInterface', # v2 -> v3
'StakingInterface', # v2 -> v3
'StakingInterface', # v3 -> v4
'StakingInterface', # v3 -> v4
'PolicyManager', # v3 -> v4
'Adjudicator', # v3 -> v4
@ -297,8 +295,7 @@ def test_rollback(click_runner, testerchain, registry_filepath):
command = ('rollback',
'--contract-name', contract_name,
'--registry-infile', registry_filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--provider', TEST_PROVIDER_URI)
user_input = '0\n' + yes
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
@ -346,8 +343,7 @@ def test_nucypher_deploy_allocation_contracts(click_runner,
'--registry-infile', registry_filepath,
'--allocation-infile', mock_allocation_infile,
'--allocation-outfile', MOCK_ALLOCATION_REGISTRY_FILEPATH,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--provider', TEST_PROVIDER_URI)
account_index = '0\n'
yes = 'Y\n'

View File

@ -29,8 +29,7 @@ def test_nucypher_deploy_inspect_no_deployments(click_runner, testerchain, new_l
status_command = ('inspect',
'--provider', TEST_PROVIDER_URI,
'--registry-infile', new_local_registry.filepath,
'--poa')
'--registry-infile', new_local_registry.filepath)
result = click_runner.invoke(deploy, status_command, catch_exceptions=False)
assert result.exit_code == 0
@ -43,7 +42,6 @@ def test_set_range(click_runner, testerchain, agency_local_registry):
status_command = ('set-range',
'--provider', TEST_PROVIDER_URI,
'--registry-infile', agency_local_registry.filepath,
'--poa',
'--minimum', minimum,
'--default', default,
'--maximum', maximum)
@ -68,8 +66,7 @@ def test_nucypher_deploy_inspect_fully_deployed(click_runner, agency_local_regis
status_command = ('inspect',
'--registry-infile', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--provider', TEST_PROVIDER_URI)
result = click_runner.invoke(deploy,
status_command,
@ -101,8 +98,7 @@ def test_transfer_ownership(click_runner, testerchain, agency_local_registry):
ownership_command = ('transfer-ownership',
'--registry-infile', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--target-address', maclane,
'--poa')
'--target-address', maclane)
account_index = '0\n'
yes = 'Y\n'
@ -125,8 +121,7 @@ def test_transfer_ownership(click_runner, testerchain, agency_local_registry):
'--contract-name', STAKING_ESCROW_CONTRACT_NAME,
'--registry-infile', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--target-address', michwill,
'--poa')
'--target-address', michwill)
user_input = yes
result = click_runner.invoke(deploy,
@ -150,7 +145,6 @@ def test_bare_contract_deployment_to_alternate_registry(click_runner, agency_loc
'--provider', TEST_PROVIDER_URI,
'--registry-infile', agency_local_registry.filepath,
'--registry-outfile', ALTERNATE_REGISTRY_FILEPATH,
'--poa',
'--ignore-deployed')
user_input = '0\n' + 'Y\n' + 'DEPLOY'
@ -195,8 +189,7 @@ def test_manual_proxy_retargeting(testerchain, click_runner, token_economics):
'--contract-name', StakingEscrowDeployer.contract_name,
'--target-address', untargeted_deployment.address,
'--provider', TEST_PROVIDER_URI,
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH,
'--poa')
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH)
# Upgrade
user_input = '0\n' + 'Y\n' + 'Y\n'
@ -220,8 +213,7 @@ def test_manual_deployment_of_idle_network(click_runner):
command = ('contracts',
'--contract-name', NUCYPHER_TOKEN_CONTRACT_NAME,
'--provider', TEST_PROVIDER_URI,
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2,
'--poa')
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
user_input = '0\n' + 'Y\n' + INSECURE_DEVELOPMENT_PASSWORD
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
@ -238,8 +230,7 @@ def test_manual_deployment_of_idle_network(click_runner):
'--contract-name', STAKING_ESCROW_CONTRACT_NAME,
'--mode', 'idle',
'--provider', TEST_PROVIDER_URI,
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2,
'--poa')
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
user_input = '0\n' + 'Y\n'
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
@ -252,8 +243,7 @@ def test_manual_deployment_of_idle_network(click_runner):
command = ('contracts',
'--contract-name', POLICY_MANAGER_CONTRACT_NAME,
'--provider', TEST_PROVIDER_URI,
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2,
'--poa')
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
user_input = '0\n' + 'Y\n'
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
@ -266,8 +256,7 @@ def test_manual_deployment_of_idle_network(click_runner):
command = ('contracts',
'--contract-name', ADJUDICATOR_CONTRACT_NAME,
'--provider', TEST_PROVIDER_URI,
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2,
'--poa')
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
user_input = '0\n' + 'Y\n'
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
@ -281,8 +270,7 @@ def test_manual_deployment_of_idle_network(click_runner):
'--contract-name', STAKING_ESCROW_CONTRACT_NAME,
'--activate',
'--provider', TEST_PROVIDER_URI,
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2,
'--poa')
'--registry-infile', ALTERNATE_REGISTRY_FILEPATH_2)
user_input = '0\n' + 'Y\n' + 'Y\n'
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)

View File

@ -50,7 +50,6 @@ def test_deploy_multisig_contract(click_runner,
command = ['contracts',
'--registry-infile', new_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--contract-name', 'MultiSig',
'--parameters', multisig_parameters_filepath]

View File

@ -27,7 +27,7 @@ from nucypher.blockchain.eth.agents import (
)
from nucypher.blockchain.eth.token import NU
from nucypher.cli.commands.status import status
from nucypher.utilities.sandbox.constants import TEST_PROVIDER_URI
from nucypher.utilities.sandbox.constants import TEST_PROVIDER_URI, TEMPORARY_DOMAIN
from tests.fixtures import MIN_REWARD_RATE_RANGE
@ -36,7 +36,7 @@ def test_nucypher_status_network(click_runner, testerchain, agency_local_registr
network_command = ('network',
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(status, network_command, catch_exceptions=False)
assert result.exit_code == 0
@ -61,7 +61,7 @@ def test_nucypher_status_stakers(click_runner, agency_local_registry, stakers):
stakers_command = ('stakers',
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(status, stakers_command, catch_exceptions=False)
assert result.exit_code == 0
@ -79,7 +79,7 @@ def test_nucypher_status_stakers(click_runner, agency_local_registry, stakers):
stakers_command = ('stakers', '--staking-address', staking_address,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(status, stakers_command, catch_exceptions=False)
assert result.exit_code == 0
@ -101,7 +101,7 @@ def test_nucypher_status_reward_range(click_runner, agency_local_registry, stake
stakers_command = ('reward-range',
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(status, stakers_command, catch_exceptions=False)
assert result.exit_code == 0
@ -123,7 +123,7 @@ def test_nucypher_status_locked_tokens(click_runner, testerchain, agency_local_r
status_command = ('locked-tokens',
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--periods', periods)
light_parameter = [False, True]
for light in light_parameter:

View File

@ -14,6 +14,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
"""
import random
import pytest
@ -32,7 +34,7 @@ from nucypher.utilities.sandbox.constants import (
INSECURE_DEVELOPMENT_PASSWORD,
TEST_PROVIDER_URI,
MOCK_IP_ADDRESS,
select_test_port
select_test_port, TEMPORARY_DOMAIN
)
@ -55,13 +57,13 @@ def test_status(click_runner, testerchain, agency_local_registry, token_economic
command = ('status',
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',)
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(worklock, command, catch_exceptions=False)
assert result.exit_code == 0
assert f"Lot Size .............. {NU.from_nunits(token_economics.worklock_supply)}" in result.output
assert f"Min allowed bid ....... {Web3.fromWei(token_economics.worklock_min_allowed_bid, 'ether')} ETH" in result.output
assert str(NU.from_nunits(token_economics.worklock_supply)) in result.output
assert str(Web3.fromWei(token_economics.worklock_min_allowed_bid, 'ether')) in result.output
def test_bid(click_runner, testerchain, agency_local_registry, token_economics, bids):
@ -72,7 +74,7 @@ def test_bid(click_runner, testerchain, agency_local_registry, token_economics,
base_command = ('bid',
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--force')
worklock_agent = ContractAgency.get_agent(WorkLockAgent, registry=agency_local_registry)
@ -106,7 +108,7 @@ def test_cancel_bid(click_runner, testerchain, agency_local_registry, token_econ
'--bidder-address', bidder,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--force')
user_input = f'{INSECURE_DEVELOPMENT_PASSWORD}\n' + 'Y\n'
@ -122,7 +124,7 @@ def test_cancel_bid(click_runner, testerchain, agency_local_registry, token_econ
'--bidder-address', bidder,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--force')
user_input = f'{INSECURE_DEVELOPMENT_PASSWORD}\n' + 'Y\n'
@ -145,8 +147,8 @@ def test_post_initialization(click_runner, testerchain, agency_local_registry, t
'--bidder-address', bidder,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--force',
'--network', TEMPORARY_DOMAIN,
'--gas-limit', 100000)
user_input = f'{INSECURE_DEVELOPMENT_PASSWORD}\n' + 'Y\n'
@ -164,7 +166,7 @@ def test_claim(click_runner, testerchain, agency_local_registry, token_economics
'--bidder-address', bidder,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--force')
user_input = f'{INSECURE_DEVELOPMENT_PASSWORD}\n' + 'Y\n'
@ -177,7 +179,7 @@ def test_claim(click_runner, testerchain, agency_local_registry, token_economics
'--bidder-address', whale,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--force')
user_input = f'{INSECURE_DEVELOPMENT_PASSWORD}\n' + 'Y\n'
@ -200,7 +202,7 @@ def test_remaining_work(click_runner, testerchain, agency_local_registry, token_
'--bidder-address', bidder,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(worklock, command, catch_exceptions=False)
assert result.exit_code == 0
@ -247,7 +249,7 @@ def test_refund(click_runner, testerchain, agency_local_registry, token_economic
'--bidder-address', bidder,
'--registry-filepath', agency_local_registry.filepath,
'--provider', TEST_PROVIDER_URI,
'--poa',
'--network', TEMPORARY_DOMAIN,
'--force')
user_input = f'{INSECURE_DEVELOPMENT_PASSWORD}\n' + 'Y\n'
@ -266,7 +268,7 @@ def test_participant_status(click_runner, testerchain, agency_local_registry, to
'--registry-filepath', agency_local_registry.filepath,
'--bidder-address', bidder.checksum_address,
'--provider', TEST_PROVIDER_URI,
'--poa')
'--network', TEMPORARY_DOMAIN)
result = click_runner.invoke(worklock, command, catch_exceptions=False)
assert result.exit_code == 0

View File

@ -126,7 +126,6 @@ def test_stake_via_contract(click_runner,
# Let's not forget to create a stakeholder
init_args = ('stake', 'init-stakeholder',
'--poa',
'--config-root', custom_filepath,
'--provider', TEST_PROVIDER_URI,
'--network', TEMPORARY_DOMAIN,
@ -410,7 +409,6 @@ def test_ursula_init(click_runner,
testerchain):
init_args = ('ursula', 'init',
'--poa',
'--network', TEMPORARY_DOMAIN,
'--worker-address', manual_worker,
'--config-root', custom_filepath,

View File

@ -57,7 +57,6 @@ def test_new_stakeholder(click_runner,
testerchain):
init_args = ('stake', 'init-stakeholder',
'--poa',
'--config-root', custom_filepath,
'--provider', TEST_PROVIDER_URI,
'--network', TEMPORARY_DOMAIN,
@ -165,9 +164,7 @@ def test_staker_divide_stakes(click_runner,
env=dict(NUCYPHER_KEYRING_PASSWORD=INSECURE_DEVELOPMENT_PASSWORD))
assert result.exit_code == 0
stake_args = ('stake', 'list',
'--config-file', stakeholder_configuration_file_location,
'--poa')
stake_args = ('stake', 'list', '--config-file', stakeholder_configuration_file_location)
user_input = INSECURE_DEVELOPMENT_PASSWORD
result = click_runner.invoke(nucypher_cli, stake_args, input=user_input, catch_exceptions=False)
@ -239,7 +236,6 @@ def test_ursula_init(click_runner,
testerchain):
init_args = ('ursula', 'init',
'--poa',
'--network', TEMPORARY_DOMAIN,
'--worker-address', manual_worker,
'--config-root', custom_filepath,