Fixes some bugs based on E2E testing

This commit is contained in:
Sergi Delgado Segura
2020-01-16 17:08:44 +01:00
parent d3846c1fe6
commit 90e1245a84
3 changed files with 23 additions and 9 deletions

View File

@@ -15,6 +15,19 @@ def check_sha256_hex_format(value):
return isinstance(value, str) and re.match(r"^[0-9A-Fa-f]{64}$", value) is not None
def check_locator_format(value):
"""
Checks if a given value is a 16-byte hex encoded string.
Args:
value(:mod:`str`): the value to be checked.
Returns:
:mod:`bool`: Whether or not the value matches the format.
"""
return isinstance(value, str) and re.match(r"^[0-9A-Fa-f]{32}$", value) is not None
def compute_locator(tx_id):
"""
Computes an appointment locator given a transaction id.