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)
Exemple #2
0
def test_token_wallet_get_total_amount_invalid():
    test_wallet = TokenWallet("Test Wallet")
    total = test_wallet.get_total_address_amount(None)
    assert total == 0