Example #1
0
    def test_convert_hex_to_bytes(self):
        data = b'\x9f<\x8d\xec\xfc5n\xca\xef?\x11\xb8\x7fx<Z!=\x85>\x94R\x13\xbbI\x1f\xf7i_\xd6\xb0\xf3'
        assert utils.convert_hex_to_bytes(data) == data
        assert utils.convert_hex_to_bytes(binascii.hexlify(data)) == data

        with pytest.raises(
                NotValidParamError,
                match="Value should be 32 byte hash or hex encoded string"):
            utils.convert_hex_to_bytes(None)

        bad_value = data + ' '.encode()
        with pytest.raises(NotValidParamError):
            utils.convert_hex_to_bytes(bad_value)
Example #2
0
 def __init__(self, memo_return):
     self.memo_return = convert_hex_to_bytes(memo_return)
Example #3
0
 def __init__(self, memo_hash):
     self.memo_hash = convert_hex_to_bytes(memo_hash)