2016-12-02 12:06:20 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Text
|
2017-11-16 00:43:10 +01:00
|
|
|
|
2016-12-02 12:06:20 +01:00
|
|
|
from zerver.lib.test_classes import WebhookTestCase
|
|
|
|
|
|
|
|
class HerokuHookTests(WebhookTestCase):
|
|
|
|
STREAM_NAME = 'heroku'
|
|
|
|
URL_TEMPLATE = u"/api/v1/external/heroku?stream={stream}&api_key={api_key}"
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def test_deployment(self) -> None:
|
2016-12-02 12:06:20 +01:00
|
|
|
expected_subject = "sample-project"
|
|
|
|
expected_message = u"""user@example.com deployed version 3eb5f44 of \
|
|
|
|
[sample-project](http://sample-project.herokuapp.com)
|
|
|
|
> * Example User: Test commit for Deploy Hook 2"""
|
|
|
|
self.send_and_test_stream_message('deploy', expected_subject, expected_message,
|
|
|
|
content_type="application/x-www-form-urlencoded")
|
|
|
|
|
2017-11-04 07:47:46 +01:00
|
|
|
def get_body(self, fixture_name: Text) -> Text:
|
2016-12-02 12:06:20 +01:00
|
|
|
return self.fixture_data("heroku", fixture_name, file_type="txt")
|