mirror of
https://github.com/logos-messaging/logos-messaging-interop-tests.git
synced 2026-01-02 14:03:08 +00:00
adding test cases for wrong encoding 7 no encoding of pubsub topic
This commit is contained in:
parent
2c3d84d833
commit
7f397bad82
@ -93,7 +93,20 @@ class REST(BaseClient):
|
||||
return get_messages_response.json()
|
||||
|
||||
def get_store_messages(
|
||||
self, peer_addr, include_data, pubsub_topic, content_topics, start_time, end_time, hashes, cursor, page_size, ascending, store_v, **kwargs
|
||||
self,
|
||||
peer_addr,
|
||||
include_data,
|
||||
pubsub_topic,
|
||||
content_topics,
|
||||
start_time,
|
||||
end_time,
|
||||
hashes,
|
||||
cursor,
|
||||
page_size,
|
||||
ascending,
|
||||
store_v,
|
||||
encode_pubsubtopic=True,
|
||||
**kwargs,
|
||||
):
|
||||
base_url = f"store/{store_v}/messages"
|
||||
params = []
|
||||
@ -103,7 +116,10 @@ class REST(BaseClient):
|
||||
if include_data is not None:
|
||||
params.append(f"includeData={include_data}")
|
||||
if pubsub_topic is not None:
|
||||
params.append(f"pubsubTopic={quote(pubsub_topic, safe='')}")
|
||||
if encode_pubsubtopic:
|
||||
params.append(f"pubsubTopic={quote(pubsub_topic, safe='')}")
|
||||
else:
|
||||
params.append(f"pubsubTopic={pubsub_topic}")
|
||||
if content_topics is not None:
|
||||
params.append(f"contentTopics={quote(content_topics, safe='')}")
|
||||
if start_time is not None:
|
||||
|
||||
@ -149,3 +149,22 @@ class TestTopics(StepsStore):
|
||||
except Exception as e:
|
||||
logger.error(f"store request with very long pubsub topic wasn't accepted ")
|
||||
assert e.args[0].find("Client Error: Request Header Fields Too Large for url") != -1, "error isn't for large url"
|
||||
|
||||
def test_store_with_wrong_encoding_pubsubtopic(self):
|
||||
wrong_encoidng_topic = "%23waku%2F2%2Frs%2F3%2F0"
|
||||
empty_response = []
|
||||
logger.debug(f"trying get message with wrong encoded pubsub topic {wrong_encoidng_topic}")
|
||||
store_response = self.store_nodes[0].get_store_messages(
|
||||
pubsub_topic=wrong_encoidng_topic, encode_pubsubtopic=False, include_data="true", page_size=20, ascending="true"
|
||||
)
|
||||
logger.debug(f"response for getting message with wrong encoded pubsub topic {store_response}")
|
||||
assert store_response["messages"] == empty_response, "Error !! message retrieved with wrong encoding pubsub_topic"
|
||||
|
||||
def test_store_without_encoding_pubsubtopic(self):
|
||||
topic = PUBSUB_TOPICS_STORE[0]
|
||||
logger.debug(f"trying get message with wrong encoded pubsub topic {topic}")
|
||||
store_response = self.store_nodes[0].get_store_messages(
|
||||
pubsub_topic=topic, encode_pubsubtopic=False, include_data="true", page_size=20, ascending="true"
|
||||
)
|
||||
logger.debug(f"response for getting message without encoding pubsub topic {store_response}")
|
||||
assert store_response["messages"][0]["pubsubTopic"] == PUBSUB_TOPICS_STORE[0], "topics Don't match !!"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user