Stubbing CLI selection tests

pull/1989/head
Kieran Prasch 2020-05-13 21:15:45 -07:00
parent 713eab4854
commit 71dc3c0029
No known key found for this signature in database
GPG Key ID: 199AB839D4125A62
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import pytest
from nucypher.blockchain.eth.actors import StakeHolder
from nucypher.blockchain.eth.token import Stake
from nucypher.cli.actions.select import select_stake
from nucypher.cli.literature import ONLY_DISPLAYING_DIVISIBLE_STAKES_NOTE
@pytest.fixture()
def mock_stakeholder(test_registry, mock_staking_agent):
stakeholder = StakeHolder(registry=test_registry)
return stakeholder
def test_select_stake(test_emitter,
mock_staking_agent,
test_registry,
mock_testerchain,
mock_click_prompt,
stdout_trap):
stakes = [(1, 2, 3)]
mock_staking_agent.get_all_stakes.return_value = stakes
mock_stakeholder = StakeHolder(registry=test_registry)
mock_click_prompt.return_value = True
result = select_stake(emitter=test_emitter, stakeholder=mock_stakeholder)
assert result
# Divisible only
# output = stdout_trap.getvalue()
# assert ONLY_DISPLAYING_DIVISIBLE_STAKES_NOTE in output