2021-06-25 00:55:44 +02:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
|
|
|
|
|
|
class OpenCollectiveHookTests(WebhookTestCase):
|
2024-05-04 22:02:50 +02:00
|
|
|
CHANNEL_NAME = "test"
|
2021-06-25 00:55:44 +02:00
|
|
|
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
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "New Member"
|
2021-06-25 00:55:44 +02:00
|
|
|
expected_message = "@_**Λευτέρης Κυριαζάνος** donated **€1.00**! :tada:"
|
|
|
|
|
|
|
|
self.check_webhook(
|
|
|
|
"one_time_donation",
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name,
|
2021-06-25 00:55:44 +02:00
|
|
|
expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded",
|
|
|
|
)
|
|
|
|
|
|
|
|
def test_one_time_incognito_donation(self) -> None: # test one time incognito donation
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name = "New Member"
|
2021-06-25 00:55:44 +02:00
|
|
|
expected_message = "An **Incognito** member donated **$1.00**! :tada:"
|
|
|
|
|
|
|
|
# use fixture named helloworld_hello
|
|
|
|
self.check_webhook(
|
|
|
|
"one_time_incognito_donation",
|
2024-01-17 15:53:30 +01:00
|
|
|
expected_topic_name,
|
2021-06-25 00:55:44 +02:00
|
|
|
expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded",
|
|
|
|
)
|