Add github tests for commits more than limit.

This commit is contained in:
Tomasz Kolek
2016-10-07 15:49:35 +02:00
committed by Tim Abbott
parent ad5d5f2c99
commit 8fa9ee1473
3 changed files with 2346 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@ from six import text_type
from typing import Dict, Optional
from zerver.models import Message
from zerver.lib.webhooks.git import PUSH_COMMITS_LIMIT
from zerver.lib.test_helpers import WebhookTestCase
class GithubV1HookTests(WebhookTestCase):
@@ -75,6 +76,15 @@ class GithubV1HookTests(WebhookTestCase):
# type: () -> None
self.basic_test('push', 'commits', 'zulip-test / master', self.push_content)
def test_push_multiple_commits(self):
# type: () -> None
commit_info = "* [48c329a](https://github.com/zbenjamin/zulip-test/commit/48c329a0b68a9a379ff195ee3f1c1f4ab0b2a89e): Add baz\n"
expected_subject = "zbenjamin [pushed](https://github.com/zbenjamin/zulip-test/compare/4f9adc4777d5...b95449196980) to branch master\n\n{}[and {} more commit(s)]".format(
commit_info * PUSH_COMMITS_LIMIT,
50 - PUSH_COMMITS_LIMIT,
)
self.basic_test('push_commits_more_than_limit', 'commits', 'zulip-test / master', expected_subject)
def test_issues_opened(self):
# type: () -> None
self.basic_test('issues_opened', 'issues',
@@ -202,6 +212,16 @@ class GithubV2HookTests(WebhookTestCase):
self.basic_test('push', 'my_commits', 'zulip-test / master', self.push_content,
send_stream=True)
def test_push_multiple_commits(self):
# type: () -> None
commit_info = "* [48c329a](https://github.com/zbenjamin/zulip-test/commit/48c329a0b68a9a379ff195ee3f1c1f4ab0b2a89e): Add baz\n"
expected_subject = "zbenjamin [pushed](https://github.com/zbenjamin/zulip-test/compare/4f9adc4777d5...b95449196980) to branch master\n\n{}[and {} more commit(s)]".format(
commit_info * PUSH_COMMITS_LIMIT,
50 - PUSH_COMMITS_LIMIT,
)
self.basic_test('push_commits_more_than_limit', 'commits', 'zulip-test / master', expected_subject)
def test_legacy_hook(self):
# type: () -> None
self.basic_test('push', 'commits', 'zulip-test / master', self.push_content)