mirror of https://github.com/zulip/zulip.git
Rename bitbucket2 fixtures directory to bitbucket.
Rename all bitbucket fixtrues from bitbucket2.* to bitbucket_v2.*.
This commit is contained in:
parent
66a740b5c1
commit
165cdb79d9
|
@ -5,7 +5,7 @@ from zerver.lib.test_helpers import WebhookTestCase
|
||||||
class Bitbucket2HookTests(WebhookTestCase):
|
class Bitbucket2HookTests(WebhookTestCase):
|
||||||
STREAM_NAME = 'bitbucket2'
|
STREAM_NAME = 'bitbucket2'
|
||||||
URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}"
|
URL_TEMPLATE = "/api/v1/external/bitbucket2?stream={stream}&api_key={api_key}"
|
||||||
FIXTURE_DIR_NAME = 'bitbucket2'
|
FIXTURE_DIR_NAME = 'bitbucket'
|
||||||
EXPECTED_SUBJECT = u"Repository name"
|
EXPECTED_SUBJECT = u"Repository name"
|
||||||
EXPECTED_SUBJECT_BRANCH_EVENTS = u"Repository name / master"
|
EXPECTED_SUBJECT_BRANCH_EVENTS = u"Repository name / master"
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
commit_info = u'* [84b96ad](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed): first commit'
|
commit_info = u'* [84b96ad](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed): first commit'
|
||||||
expected_message = u"kolaszek [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) to branch master\n\n{}".format(commit_info)
|
expected_message = u"kolaszek [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) to branch master\n\n{}".format(commit_info)
|
||||||
self.send_and_test_stream_message('push', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
self.send_and_test_stream_message('v2_push', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_push_commits_above_limit_event(self):
|
def test_bitbucket2_on_push_commits_above_limit_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -23,47 +23,47 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
(commit_info * 10),
|
(commit_info * 10),
|
||||||
number_of_hidden_commits
|
number_of_hidden_commits
|
||||||
)
|
)
|
||||||
self.send_and_test_stream_message('push_commits_above_limit', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
self.send_and_test_stream_message('v2_push_commits_above_limit', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_force_push_event(self):
|
def test_bitbucket2_on_force_push_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"kolaszek [force pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) to branch master. Head is now 25f93d22b719e2d678a7ad5ee0ef0d1fcdf39c12"
|
expected_message = u"kolaszek [force pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) to branch master. Head is now 25f93d22b719e2d678a7ad5ee0ef0d1fcdf39c12"
|
||||||
self.send_and_test_stream_message('force_push', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
self.send_and_test_stream_message('v2_force_push', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_remove_branch_event(self):
|
def test_bitbucket2_on_remove_branch_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"kolaszek deleted branch master"
|
expected_message = u"kolaszek deleted branch master"
|
||||||
self.send_and_test_stream_message('remove_branch', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
self.send_and_test_stream_message('v2_remove_branch', self.EXPECTED_SUBJECT_BRANCH_EVENTS, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_fork_event(self):
|
def test_bitbucket2_on_fork_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"User Tomasz(login: kolaszek) forked the repository into [kolaszek/repository-name2](https://bitbucket.org/kolaszek/repository-name2)."
|
expected_message = u"User Tomasz(login: kolaszek) forked the repository into [kolaszek/repository-name2](https://bitbucket.org/kolaszek/repository-name2)."
|
||||||
self.send_and_test_stream_message('fork', self.EXPECTED_SUBJECT, expected_message)
|
self.send_and_test_stream_message('v2_fork', self.EXPECTED_SUBJECT, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_commit_comment_created_event(self):
|
def test_bitbucket2_on_commit_comment_created_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"User Tomasz(login: kolaszek) added [comment](https://bitbucket.org/kolaszek/repository-name/commits/32c4ea19aa3af10acd08e419e2c354941a365d74#comment-3354963) to commit."
|
expected_message = u"User Tomasz(login: kolaszek) added [comment](https://bitbucket.org/kolaszek/repository-name/commits/32c4ea19aa3af10acd08e419e2c354941a365d74#comment-3354963) to commit."
|
||||||
self.send_and_test_stream_message('commit_comment_created', self.EXPECTED_SUBJECT, expected_message)
|
self.send_and_test_stream_message('v2_commit_comment_created', self.EXPECTED_SUBJECT, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_commit_status_changed_event(self):
|
def test_bitbucket2_on_commit_status_changed_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"[System mybuildtool](https://my-build-tool.com/builds/MY-PROJECT/BUILD-777) changed status of https://bitbucket.org/kolaszek/repository-name/9fec847784abb10b2fa567ee63b85bd238955d0e to SUCCESSFUL."
|
expected_message = u"[System mybuildtool](https://my-build-tool.com/builds/MY-PROJECT/BUILD-777) changed status of https://bitbucket.org/kolaszek/repository-name/9fec847784abb10b2fa567ee63b85bd238955d0e to SUCCESSFUL."
|
||||||
self.send_and_test_stream_message('commit_status_changed', self.EXPECTED_SUBJECT, expected_message)
|
self.send_and_test_stream_message('v2_commit_status_changed', self.EXPECTED_SUBJECT, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_issue_created_event(self):
|
def test_bitbucket2_on_issue_created_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"User Tomasz(login: kolaszek) created [an issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
expected_message = u"User Tomasz(login: kolaszek) created [an issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
||||||
self.send_and_test_stream_message('issue_created', self.EXPECTED_SUBJECT, expected_message)
|
self.send_and_test_stream_message('v2_issue_created', self.EXPECTED_SUBJECT, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_issue_updated_event(self):
|
def test_bitbucket2_on_issue_updated_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"User Tomasz(login: kolaszek) updated [an issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
expected_message = u"User Tomasz(login: kolaszek) updated [an issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
||||||
self.send_and_test_stream_message('issue_updated', self.EXPECTED_SUBJECT, expected_message)
|
self.send_and_test_stream_message('v2_issue_updated', self.EXPECTED_SUBJECT, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_issue_commented_event(self):
|
def test_bitbucket2_on_issue_commented_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
expected_message = u"User Tomasz(login: kolaszek) commented [an issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
expected_message = u"User Tomasz(login: kolaszek) commented [an issue](https://bitbucket.org/kolaszek/repository-name/issues/2/bug)"
|
||||||
self.send_and_test_stream_message('issue_commented', self.EXPECTED_SUBJECT, expected_message)
|
self.send_and_test_stream_message('v2_issue_commented', self.EXPECTED_SUBJECT, expected_message)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_created_event(self):
|
def test_bitbucket2_on_pull_request_created_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -71,7 +71,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:created'
|
"HTTP_X_EVENT_KEY": 'pullrequest:created'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_created_or_updated', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_created_or_updated', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_updated_event(self):
|
def test_bitbucket2_on_pull_request_updated_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -79,7 +79,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:updated'
|
"HTTP_X_EVENT_KEY": 'pullrequest:updated'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_created_or_updated', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_created_or_updated', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_approved_event(self):
|
def test_bitbucket2_on_pull_request_approved_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -87,7 +87,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:approved'
|
"HTTP_X_EVENT_KEY": 'pullrequest:approved'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_approved_or_unapproved', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_approved_or_unapproved', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_unapproved_event(self):
|
def test_bitbucket2_on_pull_request_unapproved_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -95,7 +95,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:unapproved'
|
"HTTP_X_EVENT_KEY": 'pullrequest:unapproved'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_approved_or_unapproved', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_approved_or_unapproved', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_declined_event(self):
|
def test_bitbucket2_on_pull_request_declined_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -103,7 +103,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:rejected'
|
"HTTP_X_EVENT_KEY": 'pullrequest:rejected'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_merged_or_rejected', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_merged_or_rejected', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_merged_event(self):
|
def test_bitbucket2_on_pull_request_merged_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -111,7 +111,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:merged'
|
"HTTP_X_EVENT_KEY": 'pullrequest:merged'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_merged_or_rejected', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_merged_or_rejected', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_comment_created_event(self):
|
def test_bitbucket2_on_pull_request_comment_created_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -119,7 +119,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:comment_created'
|
"HTTP_X_EVENT_KEY": 'pullrequest:comment_created'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_comment_action', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_comment_action', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_comment_updated_event(self):
|
def test_bitbucket2_on_pull_request_comment_updated_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -127,7 +127,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:comment_updated'
|
"HTTP_X_EVENT_KEY": 'pullrequest:comment_updated'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_comment_action', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_comment_action', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
||||||
def test_bitbucket2_on_pull_request_comment_deleted_event(self):
|
def test_bitbucket2_on_pull_request_comment_deleted_event(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@ -135,4 +135,4 @@ class Bitbucket2HookTests(WebhookTestCase):
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"HTTP_X_EVENT_KEY": 'pullrequest:comment_deleted'
|
"HTTP_X_EVENT_KEY": 'pullrequest:comment_deleted'
|
||||||
}
|
}
|
||||||
self.send_and_test_stream_message('pull_request_comment_action', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
self.send_and_test_stream_message('v2_pull_request_comment_action', self.EXPECTED_SUBJECT, expected_message, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue