Files
zulip/zerver/webhooks/opencollective/tests.py
Prakhar Pratyush 3afc8ed7ae webhooks: Rename *topic local variables to *topic_name.
This is preparatory work towards adding a Topic model.
We plan to use the local variable name as 'topic' for
the Topic model objects.

Currently, we use *topic as the local variable name for
topic names.

We rename local variables of the form *topic to *topic_name
so that we don't need to think about type collisions in
individual code paths where we might want to talk about both
Topic objects and strings for the topic name.
2024-01-17 08:35:29 -08:00

32 lines
1.2 KiB
Python

from zerver.lib.test_classes import WebhookTestCase
class OpenCollectiveHookTests(WebhookTestCase):
STREAM_NAME = "test"
URL_TEMPLATE = "/api/v1/external/opencollective?&api_key={api_key}&stream={stream}"
WEBHOOK_DIR_NAME = "opencollective"
# Note: Include a test function per each distinct message condition your integration supports
def test_one_time_donation(self) -> None: # test one time donation
expected_topic_name = "New Member"
expected_message = "@_**Λευτέρης Κυριαζάνος** donated **€1.00**! :tada:"
self.check_webhook(
"one_time_donation",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)
def test_one_time_incognito_donation(self) -> None: # test one time incognito donation
expected_topic_name = "New Member"
expected_message = "An **Incognito** member donated **$1.00**! :tada:"
# use fixture named helloworld_hello
self.check_webhook(
"one_time_incognito_donation",
expected_topic_name,
expected_message,
content_type="application/x-www-form-urlencoded",
)