2020-07-29 14:33:41 +02:00
|
|
|
import json
|
|
|
|
|
2020-07-24 16:09:30 +02:00
|
|
|
from taler.util.amount import Amount
|
|
|
|
|
|
|
|
|
2020-07-29 11:03:59 +02:00
|
|
|
def check_single_balance(
|
2020-07-29 14:33:41 +02:00
|
|
|
balances,
|
|
|
|
available,
|
|
|
|
pending_in=Amount.parse("TESTKUDOS:0"),
|
|
|
|
pending_out=Amount.parse("TESTKUDOS:0"),
|
2020-07-29 11:03:59 +02:00
|
|
|
):
|
2020-07-24 16:09:30 +02:00
|
|
|
assert len(balances) == 1
|
2020-07-29 11:03:59 +02:00
|
|
|
assert Amount.parse(balances[0]["available"]) == available
|
|
|
|
assert Amount.parse(balances[0]["pendingIncoming"]) == pending_in
|
|
|
|
assert Amount.parse(balances[0]["pendingOutgoing"]) == pending_out
|
2020-07-24 16:09:30 +02:00
|
|
|
|
|
|
|
|
|
|
|
def json_to_amount(d):
|
|
|
|
return Amount(d["currency"], d["value"], d["fraction"])
|
2020-07-29 14:33:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
def print_json(obj):
|
|
|
|
print(json.dumps(obj, indent=2))
|