def test_long_message(self): amount = b'\x00\x00\x00\x00\x00\x00\x00\x00' _, outputs = sanitize_tx_data(UNSPENTS, [(out[0], out[1], 'satoshi') for out in OUTPUTS], 0, RETURN_ADDRESS, message='hello' * 50) assert construct_output_block(outputs).count(amount) == 2
def test_message(self): assert construct_output_block(OUTPUTS + MESSAGES) == hex_to_bytes(OUTPUT_BLOCK_MESSAGES)
def test_no_message(self): assert construct_output_block(OUTPUTS) == hex_to_bytes(OUTPUT_BLOCK)
def test_string_pushdata(self): # Preferable to raise TypeError if string input with custom_pushdata=True. with pytest.raises(TypeError): construct_output_block(OUTPUTS + [("hello", 0)], custom_pushdata=True)
def test_pushdata_message(self): BYTES = len(b"hello").to_bytes(1, byteorder="little") + b"hello" assert construct_output_block(OUTPUTS + [(BYTES, 0)], custom_pushdata=True) == hex_to_bytes( OUTPUT_BLOCK_MESSAGE_PUSHDATA)