def test_update_multiple_address_outputs(): wallet = TokenWallet() address1 = Address() address2 = Address() address3 = Address() wallet.add_new_address(address1) wallet.add_new_address(address2) fake_get_utxo_resp = { OUTPUTS: [{ "address": address1.address, "seqNo": 1, "amount": 10 }, { "address": address1.address, "seqNo": 2, "amount": 10 }, { "address": address2.address, "seqNo": 3, "amount": 10 }, { "address": address3.address, "seqNo": 4, "amount": 30 }] } wallet.handle_get_utxo_response(fake_get_utxo_resp) assert 20 == wallet.get_total_address_amount(address1.address) assert 10 == wallet.get_total_address_amount(address2.address) assert 0 == wallet.get_total_address_amount(address3.address)
def test_token_wallet_add_new_address_seed_used(): wallet = TokenWallet("TestWallet") address = Address(b'Falcon00000000000000000000000000') address1 = Address(b'Falcon00000000000000000000000000') wallet.add_new_address(address) with pytest.raises(AssertionError): wallet.add_new_address(address1)
def test_token_wallet_add_new_address_already_used(): wallet = TokenWallet("TestWallet") address = Address() wallet.add_new_address(address) with pytest.raises(AssertionError): # add address to wallet second time wallet.add_new_address(address)
def seller_token_wallet(): return TokenWallet('SELLER')
def SF_token_wallet(): return TokenWallet('SF_MASTER')
def user3_token_wallet(): return TokenWallet('user3')
def user2_token_wallet(): return TokenWallet('user2')
def user1_token_wallet(): return TokenWallet('user1')
def wallet(): return TokenWallet()
def test_token_wallet_add_new_address_success(): wallet = TokenWallet("TestWallet") address = Address() wallet.add_new_address(address) assert address.address in wallet.addresses
def test_wallet(address0, address1, address2): wallet = TokenWallet("TestWallet") wallet.add_new_address(address0) wallet.add_new_address(address1) wallet.add_new_address(address2) return wallet
def test_token_wallet_get_total_amount_invalid(): test_wallet = TokenWallet("Test Wallet") total = test_wallet.get_total_address_amount(None) assert total == 0
def test_token_wallet_add_new_address_none_fail(): wallet = TokenWallet("TestWallet") with pytest.raises(AssertionError): wallet.add_new_address(None)