zulip/zerver/tests/webhooks/test_stash.py

28 lines
1.1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from six import text_type
from zerver.lib.test_helpers import WebhookTestCase
class StashHookTests(WebhookTestCase):
STREAM_NAME = 'stash'
URL_TEMPLATE = u"/api/v1/external/stash?stream={stream}"
def test_stash_message(self):
# type: () -> None
"""
Messages are generated by Stash on a `git push`.
The subject describes the repo and Stash "project". The
content describes the commits pushed.
"""
expected_subject = u"Secret project/Operation unicorn: master"
expected_message = """`f259e90` was pushed to **master** in **Secret project/Operation unicorn** with:
* `f259e90`: Updating poms ..."""
self.send_and_test_stream_message('push', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded",
**self.api_auth(self.TEST_USER_EMAIL))
def get_body(self, fixture_name):
# type: (text_type) -> text_type
return self.fixture_data("stash", fixture_name, file_type="json")