mirror of https://github.com/nucypher/nucypher.git
Test account generation of TesterBlockchain
parent
a93ddeddea
commit
82e59786ef
|
@ -14,6 +14,11 @@ 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 web3
|
||||
|
||||
from nucypher.blockchain.eth.constants import (NUMBER_OF_ETH_TEST_ACCOUNTS,
|
||||
NUMBER_OF_URSULAS_IN_BLOCKCHAIN_TESTS)
|
||||
from nucypher.utilities.sandbox.constants import TESTING_ETH_AIRDROP_AMOUNT
|
||||
|
||||
|
||||
def test_testerchain_creation(testerchain):
|
||||
|
@ -21,4 +26,25 @@ def test_testerchain_creation(testerchain):
|
|||
assert 'tester' in testerchain.interface.provider_uri
|
||||
|
||||
# ... and that there are already some blocks mined
|
||||
assert testerchain.interface.w3.eth.blockNumber >= 0
|
||||
assert testerchain.interface.w3.eth.blockNumber > 0
|
||||
|
||||
# Check that we have enough test accounts
|
||||
assert len(testerchain.interface.w3.eth.accounts) >= NUMBER_OF_ETH_TEST_ACCOUNTS
|
||||
|
||||
# Check that distinguished accounts are assigned
|
||||
etherbase = testerchain.etherbase_account
|
||||
assert etherbase == testerchain.interface.w3.eth.accounts[0]
|
||||
|
||||
alice = testerchain.alice_account
|
||||
assert alice == testerchain.interface.w3.eth.accounts[1]
|
||||
|
||||
bob = testerchain.bob_account
|
||||
assert bob == testerchain.interface.w3.eth.accounts[2]
|
||||
|
||||
ursulas = [testerchain.ursula_account(i) for i in range(NUMBER_OF_URSULAS_IN_BLOCKCHAIN_TESTS)]
|
||||
assert ursulas == testerchain.ursulas_accounts
|
||||
|
||||
# Check that accounts are funded
|
||||
for account in testerchain.interface.w3.eth.accounts:
|
||||
assert testerchain.interface.w3.eth.getBalance(account) >= TESTING_ETH_AIRDROP_AMOUNT
|
||||
|
||||
|
|
Loading…
Reference in New Issue