From 2a07362bad9c0d6bc0c52bbd42b109cda85bc80e Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Mon, 30 Jan 2017 16:11:44 +0100 Subject: [PATCH] test transaction supports unicode --- tests/db/test_bigchain_api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/db/test_bigchain_api.py b/tests/db/test_bigchain_api.py index 4d9314a1..aa8488c4 100644 --- a/tests/db/test_bigchain_api.py +++ b/tests/db/test_bigchain_api.py @@ -1222,3 +1222,15 @@ def test_cant_spend_same_input_twice_in_tx(b, genesis_block): assert b.is_valid_transaction(tx_transfer_signed) is False with pytest.raises(DoubleSpend): tx_transfer_signed.validate(b) + + +@pytest.mark.bdb +def test_transaction_unicode(b): + import json + from bigchaindb.models import Transaction + tx = (Transaction.create([b.me], [([b.me], 100)], + {'beer': '\N{BEER MUG}'}) + ).sign([b.me_private]) + block = b.create_block([tx]) + assert block.validate(b) == block + assert '{"beer": "\\ud83c\\udf7a"}' in json.dumps(block.to_dict())