From 4a9f0e3ef01ca418749100647c3fafd45490c06b Mon Sep 17 00:00:00 2001 From: fbarbu15 Date: Wed, 27 Dec 2023 09:27:30 +0200 Subject: [PATCH] address review comments --- src/node/waku_node.py | 2 +- src/steps/filter.py | 2 +- tests/filter/test_subscribe_create.py | 4 ++-- tests/filter/test_unsubscribe.py | 12 ++++++------ tests/filter/test_unsubscribe_all.py | 4 ++-- tests/relay/test_publish.py | 2 +- tests/relay/test_subscribe.py | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/node/waku_node.py b/src/node/waku_node.py index 31c0cd2f..dc883d57 100644 --- a/src/node/waku_node.py +++ b/src/node/waku_node.py @@ -78,7 +78,7 @@ class WakuNode: } default_args.update(nwaku_args) else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") for key, value in kwargs.items(): key = key.replace("_", "-") diff --git a/src/steps/filter.py b/src/steps/filter.py index 7f8fcb4f..efb84308 100644 --- a/src/steps/filter.py +++ b/src/steps/filter.py @@ -186,7 +186,7 @@ class StepsFilter: elif node.is_nwaku(): return node.get_filter_messages(content_topic) else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") @allure.step def create_message(self, **kwargs): diff --git a/tests/filter/test_subscribe_create.py b/tests/filter/test_subscribe_create.py index fa4f91ad..3f0fecf0 100644 --- a/tests/filter/test_subscribe_create.py +++ b/tests/filter/test_subscribe_create.py @@ -95,7 +95,7 @@ class TestFilterSubscribeCreate(StepsFilter): elif self.node2.is_gowaku(): pass else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: assert "Bad Request" in str(ex) @@ -134,6 +134,6 @@ class TestFilterSubscribeCreate(StepsFilter): elif self.node2.is_gowaku(): pass else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: assert "Bad Request" in str(ex) diff --git a/tests/filter/test_unsubscribe.py b/tests/filter/test_unsubscribe.py index d847417a..6c8ccbee 100644 --- a/tests/filter/test_unsubscribe.py +++ b/tests/filter/test_unsubscribe.py @@ -44,7 +44,7 @@ class TestFilterUnSubscribe(StepsFilter): status="can't unsubscribe" if self.node2.is_gowaku() else "", ) except Exception as ex: - assert "Not Found" and "peer has no subscriptions" in str(ex) + assert "Not Found" in str(ex) and "peer has no subscriptions" in str(ex) self.check_published_message_reaches_filter_peer() def test_filter_unsubscribe_from_non_existing_pubsub_topic(self): @@ -57,9 +57,9 @@ class TestFilterUnSubscribe(StepsFilter): elif self.node2.is_gowaku(): pass else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: - assert "Not Found" and "peer has no subscriptions" in str(ex) + assert "Not Found" in str(ex) and "peer has no subscriptions" in str(ex) self.check_published_message_reaches_filter_peer() def test_filter_unsubscribe_from_31_content_topics(self): @@ -69,7 +69,7 @@ class TestFilterUnSubscribe(StepsFilter): ) raise AssertionError("Unsubscribe from more than 30 content topics worked!!!") except Exception as ex: - assert "Not Found" and "exceeds maximum content topics: 30" in str(ex) + assert "Not Found" in str(ex) and "exceeds maximum content topics: 30" in str(ex) def test_filter_unsubscribe_with_no_content_topic(self): try: @@ -120,7 +120,7 @@ class TestFilterUnSubscribe(StepsFilter): elif self.node2.is_gowaku(): pass else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: assert "Bad Request" in str(ex) @@ -141,7 +141,7 @@ class TestFilterUnSubscribe(StepsFilter): elif self.node2.is_gowaku(): pass else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: assert "Bad Request" in str(ex) diff --git a/tests/filter/test_unsubscribe_all.py b/tests/filter/test_unsubscribe_all.py index 3abf8816..f966f18b 100644 --- a/tests/filter/test_unsubscribe_all.py +++ b/tests/filter/test_unsubscribe_all.py @@ -46,11 +46,11 @@ class TestFilterUnSubscribeAll(StepsFilter): raise AssertionError("Unsubscribe all on peer without subscriptions worked!!!") except Exception as ex: if self.node2.is_nwaku(): - assert "Not Found" and "peer has no subscriptions" in str(ex) + assert "Not Found" in str(ex) and "peer has no subscriptions" in str(ex) elif self.node2.is_gowaku(): assert "subscription not found" in str(ex) else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") def test_filter_unsubscribe_all_with_invalid_request_id(self, subscribe_main_nodes): try: diff --git a/tests/relay/test_publish.py b/tests/relay/test_publish.py index 8581284d..7e020a08 100644 --- a/tests/relay/test_publish.py +++ b/tests/relay/test_publish.py @@ -194,7 +194,7 @@ class TestRelayPublish(StepsRelay): elif self.node1.is_gowaku(): pass else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: assert "Bad Request" in str(ex) diff --git a/tests/relay/test_subscribe.py b/tests/relay/test_subscribe.py index 3036e4fb..0b25a7c9 100644 --- a/tests/relay/test_subscribe.py +++ b/tests/relay/test_subscribe.py @@ -76,7 +76,7 @@ class TestRelaySubscribe(StepsRelay): elif self.node1.is_gowaku(): raise AssertionError("Unsubscribe from non-subscribed pubsub_topic worked!!!") else: - raise NotImplemented("Not implemented for this node type") + raise NotImplementedError("Not implemented for this node type") except Exception as ex: assert "Bad Request" in str(ex) or "Internal Server Error" in str(ex) self.check_published_message_reaches_relay_peer()