mirror of https://github.com/nucypher/nucypher.git
Separate YES/NO (w/o linebreak) and YES_ENTER/NO_ENTER (with linebreak) in test constants
parent
844355b5fa
commit
8b9d559113
|
@ -28,7 +28,7 @@ from nucypher.config.constants import APP_DIR, DEFAULT_CONFIG_ROOT, NUCYPHER_ENV
|
||||||
from tests.constants import (
|
from tests.constants import (
|
||||||
FAKE_PASSWORD_CONFIRMED, INSECURE_DEVELOPMENT_PASSWORD,
|
FAKE_PASSWORD_CONFIRMED, INSECURE_DEVELOPMENT_PASSWORD,
|
||||||
MOCK_CUSTOM_INSTALLATION_PATH,
|
MOCK_CUSTOM_INSTALLATION_PATH,
|
||||||
MOCK_IP_ADDRESS, YES)
|
MOCK_IP_ADDRESS, YES_ENTER)
|
||||||
from tests.utils.ursula import MOCK_URSULA_STARTING_PORT
|
from tests.utils.ursula import MOCK_URSULA_STARTING_PORT
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ def test_initialize_ursula_defaults(click_runner, mocker):
|
||||||
# Use default ursula init args
|
# Use default ursula init args
|
||||||
init_args = ('ursula', 'init', '--network', TEMPORARY_DOMAIN, '--federated-only')
|
init_args = ('ursula', 'init', '--network', TEMPORARY_DOMAIN, '--federated-only')
|
||||||
|
|
||||||
user_input = YES + FAKE_PASSWORD_CONFIRMED
|
user_input = YES_ENTER + FAKE_PASSWORD_CONFIRMED
|
||||||
result = click_runner.invoke(nucypher_cli, init_args, input=user_input, catch_exceptions=False)
|
result = click_runner.invoke(nucypher_cli, init_args, input=user_input, catch_exceptions=False)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ from tests.constants import (
|
||||||
INSECURE_DEVELOPMENT_PASSWORD,
|
INSECURE_DEVELOPMENT_PASSWORD,
|
||||||
MOCK_IP_ADDRESS,
|
MOCK_IP_ADDRESS,
|
||||||
TEST_PROVIDER_URI,
|
TEST_PROVIDER_URI,
|
||||||
YES
|
YES_ENTER
|
||||||
)
|
)
|
||||||
from tests.utils.ursula import MOCK_URSULA_STARTING_PORT, start_pytest_ursula_services
|
from tests.utils.ursula import MOCK_URSULA_STARTING_PORT, start_pytest_ursula_services
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ def test_ursula_rest_host_determination(click_runner, mocker):
|
||||||
mocker.patch.object(UrsulaConfiguration, 'to_configuration_file', return_value=None)
|
mocker.patch.object(UrsulaConfiguration, 'to_configuration_file', return_value=None)
|
||||||
|
|
||||||
args = ('ursula', 'init', '--federated-only', '--network', TEMPORARY_DOMAIN)
|
args = ('ursula', 'init', '--federated-only', '--network', TEMPORARY_DOMAIN)
|
||||||
user_input = YES + FAKE_PASSWORD_CONFIRMED
|
user_input = YES_ENTER + FAKE_PASSWORD_CONFIRMED
|
||||||
result = click_runner.invoke(nucypher_cli, args, catch_exceptions=False, input=user_input)
|
result = click_runner.invoke(nucypher_cli, args, catch_exceptions=False, input=user_input)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert MOCK_IP_ADDRESS in result.output
|
assert MOCK_IP_ADDRESS in result.output
|
||||||
|
|
|
@ -139,9 +139,11 @@ PYEVM_GAS_LIMIT = TEST_GAS_LIMIT # TODO: move elsewhere (used to set pyevm gas
|
||||||
# CLI
|
# CLI
|
||||||
#
|
#
|
||||||
|
|
||||||
YES = 'Y\n'
|
YES = 'Y'
|
||||||
|
YES_ENTER = YES + '\n'
|
||||||
|
|
||||||
NO = 'N\n'
|
NO = 'N'
|
||||||
|
NO_ENTER = NO + '\n'
|
||||||
|
|
||||||
FAKE_PASSWORD_CONFIRMED = '{password}\n{password}\n'.format(password=INSECURE_DEVELOPMENT_PASSWORD)
|
FAKE_PASSWORD_CONFIRMED = '{password}\n{password}\n'.format(password=INSECURE_DEVELOPMENT_PASSWORD)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ from nucypher.blockchain.eth.interfaces import BlockchainInterface
|
||||||
from nucypher.blockchain.eth.token import NU
|
from nucypher.blockchain.eth.token import NU
|
||||||
from nucypher.cli.commands.worklock import worklock
|
from nucypher.cli.commands.worklock import worklock
|
||||||
from nucypher.config.constants import TEMPORARY_DOMAIN
|
from nucypher.config.constants import TEMPORARY_DOMAIN
|
||||||
from tests.constants import CLI_TEST_ENV, MOCK_PROVIDER_URI, YES, NO
|
from tests.constants import CLI_TEST_ENV, MOCK_PROVIDER_URI, YES_ENTER, NO_ENTER
|
||||||
from tests.mock.agents import MockContractAgent
|
from tests.mock.agents import MockContractAgent
|
||||||
from nucypher.cli.literature import CONFIRM_BID_VERIFICATION
|
from nucypher.cli.literature import CONFIRM_BID_VERIFICATION
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ def test_bid_too_soon(click_runner,
|
||||||
a_month_too_soon = now-(3600*30)
|
a_month_too_soon = now-(3600*30)
|
||||||
mocker.patch.object(BlockchainInterface, 'get_blocktime', return_value=a_month_too_soon)
|
mocker.patch.object(BlockchainInterface, 'get_blocktime', return_value=a_month_too_soon)
|
||||||
with pytest.raises(Bidder.BiddingIsClosed):
|
with pytest.raises(Bidder.BiddingIsClosed):
|
||||||
result = click_runner.invoke(worklock, bidding_command, catch_exceptions=False, input=YES, env=CLI_TEST_ENV)
|
result = click_runner.invoke(worklock, bidding_command, catch_exceptions=False, input=YES_ENTER, env=CLI_TEST_ENV)
|
||||||
assert result.exit_code != 0
|
assert result.exit_code != 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ def test_bid_too_late(click_runner,
|
||||||
a_month_too_late = now+(3600*30)
|
a_month_too_late = now+(3600*30)
|
||||||
mocker.patch.object(BlockchainInterface, 'get_blocktime', return_value=a_month_too_late)
|
mocker.patch.object(BlockchainInterface, 'get_blocktime', return_value=a_month_too_late)
|
||||||
with pytest.raises(Bidder.BiddingIsClosed):
|
with pytest.raises(Bidder.BiddingIsClosed):
|
||||||
result = click_runner.invoke(worklock, bidding_command, catch_exceptions=False, input=YES, env=CLI_TEST_ENV)
|
result = click_runner.invoke(worklock, bidding_command, catch_exceptions=False, input=YES_ENTER, env=CLI_TEST_ENV)
|
||||||
assert result.exit_code != 0
|
assert result.exit_code != 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ def test_valid_bid(click_runner,
|
||||||
'--network', TEMPORARY_DOMAIN,
|
'--network', TEMPORARY_DOMAIN,
|
||||||
'--force')
|
'--force')
|
||||||
|
|
||||||
result = click_runner.invoke(worklock, command, catch_exceptions=False, input=YES, env=CLI_TEST_ENV)
|
result = click_runner.invoke(worklock, command, catch_exceptions=False, input=YES_ENTER, env=CLI_TEST_ENV)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
# OK - Let's see what happened
|
# OK - Let's see what happened
|
||||||
|
@ -166,7 +166,7 @@ def test_cancel_bid(click_runner,
|
||||||
'--provider', MOCK_PROVIDER_URI,
|
'--provider', MOCK_PROVIDER_URI,
|
||||||
'--network', TEMPORARY_DOMAIN,
|
'--network', TEMPORARY_DOMAIN,
|
||||||
'--force')
|
'--force')
|
||||||
result = click_runner.invoke(worklock, command, input=YES, env=CLI_TEST_ENV, catch_exceptions=False)
|
result = click_runner.invoke(worklock, command, input=YES_ENTER, env=CLI_TEST_ENV, catch_exceptions=False)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
# Bidder
|
# Bidder
|
||||||
|
@ -234,7 +234,7 @@ def test_enable_claiming(click_runner,
|
||||||
|
|
||||||
gas_limit_1 = 200000
|
gas_limit_1 = 200000
|
||||||
gas_limit_2 = 300000
|
gas_limit_2 = 300000
|
||||||
user_input = YES + YES + str(gas_limit_1) + '\n' + NO + str(gas_limit_2) + '\n' + YES
|
user_input = YES_ENTER + YES_ENTER + str(gas_limit_1) + '\n' + NO_ENTER + str(gas_limit_2) + '\n' + YES_ENTER
|
||||||
result = click_runner.invoke(worklock, command, input=user_input, env=CLI_TEST_ENV, catch_exceptions=False)
|
result = click_runner.invoke(worklock, command, input=user_input, env=CLI_TEST_ENV, catch_exceptions=False)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
confirmation = CONFIRM_BID_VERIFICATION.format(bidder_address=surrogate_bidder.checksum_address,
|
confirmation = CONFIRM_BID_VERIFICATION.format(bidder_address=surrogate_bidder.checksum_address,
|
||||||
|
@ -305,7 +305,7 @@ def test_initial_claim(click_runner,
|
||||||
'--network', TEMPORARY_DOMAIN,
|
'--network', TEMPORARY_DOMAIN,
|
||||||
'--force')
|
'--force')
|
||||||
|
|
||||||
result = click_runner.invoke(worklock, command, input=YES, env=CLI_TEST_ENV, catch_exceptions=False)
|
result = click_runner.invoke(worklock, command, input=YES_ENTER, env=CLI_TEST_ENV, catch_exceptions=False)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
mock_worklock_agent.claim.assert_called_once_with(checksum_address=surrogate_bidder.checksum_address)
|
mock_worklock_agent.claim.assert_called_once_with(checksum_address=surrogate_bidder.checksum_address)
|
||||||
|
@ -352,7 +352,7 @@ def test_already_claimed(click_runner,
|
||||||
'--network', TEMPORARY_DOMAIN,
|
'--network', TEMPORARY_DOMAIN,
|
||||||
'--force')
|
'--force')
|
||||||
|
|
||||||
result = click_runner.invoke(worklock, command, input=YES, env=CLI_TEST_ENV, catch_exceptions=False)
|
result = click_runner.invoke(worklock, command, input=YES_ENTER, env=CLI_TEST_ENV, catch_exceptions=False)
|
||||||
assert result.exit_code == 1 # TODO: Decide if this case should error (like now) or simply do nothing
|
assert result.exit_code == 1 # TODO: Decide if this case should error (like now) or simply do nothing
|
||||||
|
|
||||||
# Bidder
|
# Bidder
|
||||||
|
@ -408,7 +408,7 @@ def test_refund(click_runner,
|
||||||
'--network', TEMPORARY_DOMAIN,
|
'--network', TEMPORARY_DOMAIN,
|
||||||
'--force')
|
'--force')
|
||||||
|
|
||||||
result = click_runner.invoke(worklock, command, input=YES, env=CLI_TEST_ENV, catch_exceptions=False)
|
result = click_runner.invoke(worklock, command, input=YES_ENTER, env=CLI_TEST_ENV, catch_exceptions=False)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
# Bidder
|
# Bidder
|
||||||
|
|
Loading…
Reference in New Issue