def test_unique_id():
    """Tests that unique_id generates a unique identifier and is unique
    """
    id1 = unique_id()
    id2 = unique_id()
    assert PATTERN_12_BYTE_HASH.match(id1)
    assert PATTERN_12_BYTE_HASH.match(id2)
    assert id1 != id2
 def unique_id(self):
     """Generates a random 12-byte hexadecimal string
     Override where desired behavior differs"""
     return unique_id()
def test_hash_no_rehash():
    """Test that the hash function won't rehash a 12-byte hex string
    """
    assert hash_id("3a392b49adf4b306976fb0d0") == "3a392b49adf4b306976fb0d0"
    value = unique_id()
    assert hash_id(value) == value
 def id(self):
     """Generates a random 12-byte hexidecimal string"""
     return unique_id()