nucypher/tests/integration/cli/actions/test_select_network.py

29 lines
932 B
Python
Raw Normal View History

2022-11-16 13:13:53 +00:00
import pytest
from nucypher.blockchain.eth.networks import NetworksInventory
from nucypher.cli.actions.select import select_network
__POLY_NETWORKS = NetworksInventory.POLY_NETWORKS
__ETH_NETWORKS = NetworksInventory.ETH_NETWORKS
@pytest.mark.parametrize('user_input', range(0, len(__ETH_NETWORKS)-1))
def test_select_network_cli_action_eth(test_emitter, capsys, mock_stdin, user_input):
mock_stdin.line(str(user_input))
selection = __ETH_NETWORKS[user_input]
result = select_network(emitter=test_emitter, network_type=NetworksInventory.ETH)
assert result == selection
assert result not in __POLY_NETWORKS
2020-05-24 19:35:07 +00:00
captured = capsys.readouterr()
for name in __ETH_NETWORKS:
2020-05-24 19:35:07 +00:00
assert name in captured.out
assert mock_stdin.empty()
def test_select_network_cli_action_neither(test_emitter):
with pytest.raises(Exception):
select_network(emitter=test_emitter, network_type="FAKE COIN")