mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Add github tests for commits more than limit.
This commit is contained in:
		
							
								
								
									
										1163
									
								
								zerver/fixtures/github/github_v1_push_commits_more_than_limit.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1163
									
								
								zerver/fixtures/github/github_v1_push_commits_more_than_limit.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1163
									
								
								zerver/fixtures/github/github_v2_push_commits_more_than_limit.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1163
									
								
								zerver/fixtures/github/github_v2_push_commits_more_than_limit.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -3,6 +3,7 @@ from six import text_type
 | 
				
			|||||||
from typing import Dict, Optional
 | 
					from typing import Dict, Optional
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from zerver.models import Message
 | 
					from zerver.models import Message
 | 
				
			||||||
 | 
					from zerver.lib.webhooks.git import PUSH_COMMITS_LIMIT
 | 
				
			||||||
from zerver.lib.test_helpers import WebhookTestCase
 | 
					from zerver.lib.test_helpers import WebhookTestCase
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GithubV1HookTests(WebhookTestCase):
 | 
					class GithubV1HookTests(WebhookTestCase):
 | 
				
			||||||
@@ -75,6 +76,15 @@ class GithubV1HookTests(WebhookTestCase):
 | 
				
			|||||||
        # type: () -> None
 | 
					        # type: () -> None
 | 
				
			||||||
        self.basic_test('push', 'commits', 'zulip-test / master', self.push_content)
 | 
					        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):
 | 
					    def test_issues_opened(self):
 | 
				
			||||||
        # type: () -> None
 | 
					        # type: () -> None
 | 
				
			||||||
        self.basic_test('issues_opened', 'issues',
 | 
					        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,
 | 
					        self.basic_test('push', 'my_commits', 'zulip-test / master', self.push_content,
 | 
				
			||||||
                        send_stream=True)
 | 
					                        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):
 | 
					    def test_legacy_hook(self):
 | 
				
			||||||
        # type: () -> None
 | 
					        # type: () -> None
 | 
				
			||||||
        self.basic_test('push', 'commits', 'zulip-test / master', self.push_content)
 | 
					        self.basic_test('push', 'commits', 'zulip-test / master', self.push_content)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user