From 2e9a3d12026d65d7de5c3d3fdcf5319b8417148e Mon Sep 17 00:00:00 2001 From: fbarbu15 Date: Mon, 20 May 2024 13:10:53 +0300 Subject: [PATCH] all message fields are now camel case (#40) --- src/node/waku_message.py | 18 +----------------- src/steps/store.py | 8 +++----- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/node/waku_message.py b/src/node/waku_message.py index 5756a1209c..1c63bb5b82 100644 --- a/src/node/waku_message.py +++ b/src/node/waku_message.py @@ -13,19 +13,6 @@ class MessageRpcResponse: timestamp: Optional[int] ephemeral: Optional[bool] meta: Optional[str] - rateLimitProof: Optional[Union[dict, str]] = field(default_factory=dict) - rate_limit_proof: Optional[dict] = field(default_factory=dict) - - -@dataclass -class MessageRpcResponseStore: - payload: str - content_topic: str - version: Optional[int] - timestamp: Optional[int] - ephemeral: Optional[bool] - meta: Optional[str] - rateLimitProof: Optional[Union[dict, str]] = field(default_factory=dict) rate_limit_proof: Optional[dict] = field(default_factory=dict) @@ -43,10 +30,7 @@ class WakuMessage: return f"Incorrect field: {field_name}. Published: {sent_message[field_name]} Received: {getattr(message, field_name)}" assert message.payload == sent_message["payload"], assert_fail_message("payload") - if self.schema == MessageRpcResponse: - assert message.contentTopic == sent_message["contentTopic"], assert_fail_message("contentTopic") - else: - assert message.content_topic == sent_message["contentTopic"], assert_fail_message("content_topic") + assert message.contentTopic == sent_message["contentTopic"], assert_fail_message("contentTopic") if sent_message.get("timestamp") is not None: if isinstance(sent_message["timestamp"], float): assert math.isclose(float(message.timestamp), sent_message["timestamp"], rel_tol=1e-9), assert_fail_message("timestamp") diff --git a/src/steps/store.py b/src/steps/store.py index f87574ec44..e615a1e348 100644 --- a/src/steps/store.py +++ b/src/steps/store.py @@ -3,8 +3,8 @@ from src.libs.custom_logger import get_custom_logger from time import time import pytest import allure -from src.libs.common import to_base64, delay -from src.node.waku_message import MessageRpcResponse, MessageRpcResponseStore, WakuMessage +from src.libs.common import delay +from src.node.waku_message import WakuMessage from src.env_vars import ( ADDITIONAL_NODES, NODE_1, @@ -167,9 +167,7 @@ class StepsStore(StepsCommon): assert "messages" in self.store_response, f"Peer {node.image} has no messages key in the reponse" assert self.store_response["messages"], f"Peer {node.image} couldn't find any messages" assert len(self.store_response["messages"]) >= 1, "Expected at least 1 message but got none" - waku_message = WakuMessage( - self.store_response["messages"][-1:], schema=MessageRpcResponseStore if node.is_nwaku() else MessageRpcResponse - ) + waku_message = WakuMessage(self.store_response["messages"][-1:]) waku_message.assert_received_message(self.message) @allure.step