all message fields are now camel case (#40)
This commit is contained in:
parent
73a1711d54
commit
2e9a3d1202
|
@ -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")
|
||||
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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue