-
Notifications
You must be signed in to change notification settings - Fork 1
Chore: store v3 edge test cases #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
6ed6404
81b0f20
edf12b9
9ce4b24
6effb21
f7187be
8b042de
2c3d84d
7f397ba
7eed478
b80118d
a62e204
8deaaf9
542fc00
d0bde7b
15472c6
ffd8d5b
e3405e5
bb841c1
3a7484e
82a2c0a
a7b61ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,49 @@ | ||
| import pytest | ||
| from src.libs.custom_logger import get_custom_logger | ||
| from src.libs.common import to_base64 | ||
| from src.node.waku_message import WakuMessage | ||
| from src.steps.store import StepsStore | ||
| from src.test_data import SAMPLE_INPUTS | ||
|
|
||
| logger = get_custom_logger(__name__) | ||
|
|
||
|
|
||
| @pytest.mark.usefixtures("node_setup") | ||
| class TestApiFlags(StepsStore): | ||
| def test_store_with_peerAddr(self): | ||
| self.publish_message() | ||
| self.check_published_message_is_stored(store_node=self.store_node1, peer_addr=self.multiaddr_list[0]) | ||
|
|
||
| def test_store_with_wrongPeerAddr(self): | ||
| self.publish_message() | ||
| wrong_peer_addr = self.multiaddr_list[0][1:] | ||
| logger.debug(f"logger is {wrong_peer_addr}") | ||
| try: | ||
| self.check_published_message_is_stored(store_node=self.store_node1, peer_addr=wrong_peer_addr) | ||
| raise Exception("message restored with wrong peer address") | ||
|
||
| except Exception as ex: | ||
| logger.debug(f" response with wrong peer address is { ex.args[0]}") | ||
| assert ex.args[0].find("Invalid MultiAddress") != -1 | ||
| # try to send wrong peer id | ||
| wrong_peer_id = self.multiaddr_list[0][:-1] | ||
| logger.debug(f"logger is {wrong_peer_id}") | ||
| try: | ||
| self.check_published_message_is_stored(store_node=self.store_node1, peer_addr=wrong_peer_id) | ||
| raise Exception("message restored with wrong peer id") | ||
| except Exception as ex: | ||
| logger.debug(f" response with wrong peer id is { ex.args[0]}") | ||
| assert ex.args[0].find("Failed parsing remote peer info") != -1 | ||
|
|
||
| # send address without /tcp number | ||
| wrong_peer_addr = self.multiaddr_list[0].replace("/tcp", "") | ||
| logger.debug(f"logger is {wrong_peer_addr}") | ||
| try: | ||
| self.check_published_message_is_stored(store_node=self.store_node1, peer_addr=wrong_peer_addr) | ||
| raise Exception("message restored with wrong peer address") | ||
| except Exception as ex: | ||
| logger.debug(f" response with wrong peer address is { ex.args[0]}") | ||
| assert ex.args[0].find("Unsupported protocol") != -1 | ||
|
|
||
| def test_store_include_data(self): | ||
| message_list = [] | ||
| for payload in SAMPLE_INPUTS: | ||
|
|
@@ -25,3 +58,10 @@ def test_store_include_data(self): | |
| assert store_response.message_pubsub_topic(index) == self.test_pubsub_topic | ||
| waku_message = WakuMessage([store_response.message_at(index)]) | ||
| waku_message.assert_received_message(message_list[index]) | ||
|
|
||
| def test_store_not_include_data(self): | ||
| message = self.create_message() | ||
| self.publish_message(message=message) | ||
|
||
| store_response = self.get_messages_from_store(self.store_node1, include_data="false") | ||
| logger.debug(f" message restored with hash only is {store_response.messages} ") | ||
| assert "message" not in store_response.messages | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a better log would be:
f"Running test with wrong_peer_addr: {wrong_peer_addr}"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done