Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_output_hashlock_deserialization():
from bigchaindb.common.transaction import Output
from cryptoconditions import PreimageSha256
secret = b'wow much secret'
hashlock = PreimageSha256(preimage=secret).condition_uri
expected = Output(hashlock, amount=1)
cond = {
'condition': {
'uri': hashlock
},
'public_keys': None,
'amount': '1',
}
cond = Output.from_dict(cond)
assert cond == expected
def test_output_hashlock_serialization():
from bigchaindb.common.transaction import Output
from cryptoconditions import PreimageSha256
secret = b'wow much secret'
hashlock = PreimageSha256(preimage=secret).condition_uri
expected = {
'condition': {
'uri': hashlock,
},
'public_keys': None,
'amount': '1',
}
cond = Output(hashlock, amount=1)
assert cond.to_dict() == expected