Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_classes: Remove unused VIEW_FUNCTION_NAME from WebhookTestCase.

Niloth P9a8edc3b90c9
diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py
index 68369c5e1cc..00fa6ea7998 100644
--- a/zerver/lib/test_classes.py
+++ b/zerver/lib/test_classes.py
@@ -2469,9 +2469,6 @@ class WebhookTestCase(ZulipTestCase):
TEST_USER_EMAIL = "[email protected]"
URL_TEMPLATE: str
WEBHOOK_DIR_NAME: str | None = None
- # This last parameter is a workaround to handle webhooks that do not
- # name the main function api_{WEBHOOK_DIR_NAME}_webhook.
- VIEW_FUNCTION_NAME: str | None = None
@property
def test_user(self) -> UserProfile:
@@ -2483,19 +2480,9 @@ class WebhookTestCase(ZulipTestCase):
self.url = self.build_webhook_url()
if self.WEBHOOK_DIR_NAME is not None:
- # If VIEW_FUNCTION_NAME is explicitly specified and
- # WEBHOOK_DIR_NAME is not None, an exception will be
- # raised when a test triggers events that are not
- # explicitly specified via the event_types parameter to
- # the @webhook_view decorator.
- if self.VIEW_FUNCTION_NAME is None:
- function = import_string(
- f"zerver.webhooks.{self.WEBHOOK_DIR_NAME}.view.api_{self.WEBHOOK_DIR_NAME}_webhook"
- )
- else:
- function = import_string(
- f"zerver.webhooks.{self.WEBHOOK_DIR_NAME}.view.{self.VIEW_FUNCTION_NAME}"
- )
+ function = import_string(
+ f"zerver.webhooks.{self.WEBHOOK_DIR_NAME}.view.api_{self.WEBHOOK_DIR_NAME}_webhook"
+ )
all_event_types = None
if hasattr(function, "_all_event_types"):
diff --git a/zerver/webhooks/ifttt/tests.py b/zerver/webhooks/ifttt/tests.py
index 8634155e9d9..7359bfc198e 100644
--- a/zerver/webhooks/ifttt/tests.py
+++ b/zerver/webhooks/ifttt/tests.py
@@ -5,7 +5,6 @@ class IFTTTHookTests(WebhookTestCase):
CHANNEL_NAME = "ifttt"
URL_TEMPLATE = "/api/v1/external/ifttt?stream={stream}&api_key={api_key}"
WEBHOOK_DIR_NAME = "ifttt"
- VIEW_FUNCTION_NAME = "api_ifttt_webhook"
def test_ifttt_when_subject_and_body_are_correct(self) -> None:
expected_topic_name = "Email sent from [email protected]"