more fixes

This commit is contained in:
Gabriel mermelstein 2025-01-30 13:39:43 +02:00
parent d3b0090a77
commit f1c21ffa95
No known key found for this signature in database
GPG Key ID: 82B8134785FEAE0D

View File

@ -54,7 +54,7 @@ class TestHashes(StepsStore):
except Exception as ex: except Exception as ex:
assert "waku message hash parsing error: invalid hash length" in str(ex) assert "waku message hash parsing error: invalid hash length" in str(ex)
def test_store_with_non_base64_hash(self): def test_store_with_non_hex_hash(self):
for i in range(4): for i in range(4):
self.publish_message(message=self.create_message(payload=to_base64(f"Message_{i}"))) self.publish_message(message=self.create_message(payload=to_base64(f"Message_{i}")))
non_hex_hash = "test" non_hex_hash = "test"
@ -63,7 +63,7 @@ class TestHashes(StepsStore):
store_response = self.get_messages_from_store(node, hashes=non_hex_hash, page_size=50) store_response = self.get_messages_from_store(node, hashes=non_hex_hash, page_size=50)
assert not store_response.messages assert not store_response.messages
except Exception as ex: except Exception as ex:
assert "waku message hash parsing error: invalid hash length" in str(ex) assert "Exception converting hex string to bytes: t is not a hexadecimal character" in str(ex)
# Addon on Test # Addon on Test
@ -106,14 +106,14 @@ class TestHashes(StepsStore):
except Exception as ex: except Exception as ex:
assert "waku message hash parsing error" in str(ex), "Unexpected error for combined empty and valid hash" assert "waku message hash parsing error" in str(ex), "Unexpected error for combined empty and valid hash"
# Test for hashes that include non-Base64 characters. # Test for hashes that include non-hex characters.
def test_store_with_non_base64_characters_in_hash(self): def test_store_with_non_base64_characters_in_hash(self):
non_base64_hash = "###INVALID###" # Invalid hash with non-Base64 characters non_hex_hash = "###INVALID HEX###" # Invalid hash with non-hex characters
for i in range(4): for i in range(4):
self.publish_message(message=self.create_message(payload=to_base64(f"Message_{i}"))) self.publish_message(message=self.create_message(payload=to_base64(f"Message_{i}")))
for node in self.store_nodes: for node in self.store_nodes:
store_response = self.get_store_messages_with_errors(node, hashes=non_base64_hash, page_size=50) store_response = self.get_store_messages_with_errors(node, hashes=non_hex_hash, page_size=50)
assert ( assert (
"waku message hash parsing error: Incorrect base64 string" in store_response["error_message"] "waku message hash parsing error: Incorrect base64 string" in store_response["error_message"]