git_webhooks: Use proper punctuation for PR/issue messages.

This commit is contained in:
Eeshan Garg
2019-04-19 17:32:41 -02:30
committed by Tim Abbott
parent 2d4b734415
commit ab8aae6d0c
10 changed files with 160 additions and 127 deletions

View File

@@ -10,19 +10,19 @@ class Bitbucket3HookTests(WebhookTestCase):
# Core Repo Events:
def test_commit_comment_added(self) -> None:
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) commented on [508d1b6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/commits/508d1b67f1f8f3a25f543a030a7a178894aa9907)\n~~~ quote\nJust an arbitrary comment on a commit.\n~~~"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) commented on [508d1b6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/commits/508d1b67f1f8f3a25f543a030a7a178894aa9907):\n~~~ quote\nJust an arbitrary comment on a commit.\n~~~"""
self.send_and_test_stream_message("commit_comment_added",
self.EXPECTED_TOPIC,
expected_message)
def test_commit_comment_edited(self) -> None:
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) edited their comment on [508d1b6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/commits/508d1b67f1f8f3a25f543a030a7a178894aa9907)\n~~~ quote\nJust an arbitrary comment on a commit. Nothing to see here...\n~~~"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) edited their comment on [508d1b6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/commits/508d1b67f1f8f3a25f543a030a7a178894aa9907):\n~~~ quote\nJust an arbitrary comment on a commit. Nothing to see here...\n~~~"""
self.send_and_test_stream_message("commit_comment_edited",
self.EXPECTED_TOPIC,
expected_message)
def test_commit_comment_deleted(self) -> None:
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) deleted their comment on [508d1b6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/commits/508d1b67f1f8f3a25f543a030a7a178894aa9907)\n~~~ quote\n~~Just an arbitrary comment on a commit. Nothing to see here...~~\n~~~"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) deleted their comment on [508d1b6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/commits/508d1b67f1f8f3a25f543a030a7a178894aa9907):\n~~~ quote\n~~Just an arbitrary comment on a commit. Nothing to see here...~~\n~~~"""
self.send_and_test_stream_message("commit_comment_deleted",
self.EXPECTED_TOPIC,
expected_message)
@@ -45,20 +45,20 @@ class Bitbucket3HookTests(WebhookTestCase):
expected_message)
def test_push_add_tag(self) -> None:
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) pushed tag newtag"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) pushed tag newtag."""
self.send_and_test_stream_message("repo_push_add_tag",
self.EXPECTED_TOPIC,
expected_message)
def test_push_delete_branch(self) -> None:
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) deleted branch branch2"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) deleted branch branch2."""
expected_topic = self.EXPECTED_TOPIC_BRANCH_EVENTS.format(branch="branch2")
self.send_and_test_stream_message("repo_push_delete_branch",
expected_topic,
expected_message)
def test_push_delete_tag(self) -> None:
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) removed tag test-tag"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) removed tag test-tag."""
self.send_and_test_stream_message("repo_push_delete_tag",
self.EXPECTED_TOPIC,
expected_message)
@@ -101,14 +101,14 @@ class Bitbucket3HookTests(WebhookTestCase):
# Core PR Events:
def test_pr_opened_without_reviewers(self) -> None:
expected_topic = "sandbox / PR #1 Branch1"
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) opened [PR #1](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/1)\nfrom `branch1` to `master`\n\n~~~ quote\n* Add file2.txt\r\n* Add file3.txt\n~~~"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) opened [PR #1](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/1) from `branch1` to `master`:\n\n~~~ quote\n* Add file2.txt\r\n* Add file3.txt\n~~~"""
self.send_and_test_stream_message("pull_request_opened_without_reviewers",
expected_topic,
expected_message)
def test_pr_opened_without_description(self) -> None:
expected_topic = "sandbox / PR #2 Add notes feature."
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) opened [PR #2](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/2)\nfrom `master` to `master`"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) opened [PR #2](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/2) from `master` to `master`."""
self.send_and_test_stream_message("pull_request_opened_without_description",
expected_topic,
expected_message)
@@ -153,7 +153,7 @@ class Bitbucket3HookTests(WebhookTestCase):
def test_pr_deleted(self) -> None:
expected_topic = "sandbox / PR #2 Add notes feature."
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) deleted [PR #2](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/2)"""
expected_message = """[hypro999](http://139.59.64.214:7990/users/hypro999) deleted [PR #2](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/2)."""
self.send_and_test_stream_message("pull_request_deleted",
expected_topic,
expected_message)
@@ -168,14 +168,14 @@ class Bitbucket3HookTests(WebhookTestCase):
def test_pr_declined(self) -> None:
expected_topic = "sandbox / PR #7 Crazy Idea"
expected_message = """[zura](http://139.59.64.214:7990/users/zura) declined [PR #7](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/7)"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) declined [PR #7](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/7)."""
self.send_and_test_stream_message("pull_request_declined",
expected_topic,
expected_message)
def test_pr_merged(self) -> None:
expected_topic = "sandbox / PR #6 sample_file: Add sample_file.txt."
expected_message = """[zura](http://139.59.64.214:7990/users/zura) merged [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) merged [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)."""
self.send_and_test_stream_message("pull_request_merged",
expected_topic,
expected_message)
@@ -183,14 +183,14 @@ class Bitbucket3HookTests(WebhookTestCase):
# PR Reviewer Events:
def test_pr_approved(self) -> None:
expected_topic = "sandbox / PR #6 sample_file: Add sample_file.txt."
expected_message = """[zura](http://139.59.64.214:7990/users/zura) approved [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) approved [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)."""
self.send_and_test_stream_message("pull_request_approved",
expected_topic,
expected_message)
def test_pr_unapproved(self) -> None:
expected_topic = "sandbox / PR #6 sample_file: Add sample_file.txt."
expected_message = """[zura](http://139.59.64.214:7990/users/zura) unapproved [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) unapproved [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)."""
self.send_and_test_stream_message("pull_request_unapproved",
expected_topic,
expected_message)
@@ -250,21 +250,21 @@ class Bitbucket3HookTests(WebhookTestCase):
# PR Comment Events:
def test_pull_request_comment_added(self) -> None:
expected_message = """[zura](http://139.59.64.214:7990/users/zura) commented on [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)\n\n~~~ quote\nThis seems like a pretty good idea.\n~~~"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) commented on [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6):\n\n~~~ quote\nThis seems like a pretty good idea.\n~~~"""
expected_topic = "sandbox / PR #6 sample_file: Add sample_file.txt."
self.send_and_test_stream_message("pull_request_comment_added",
expected_topic,
expected_message)
def test_pull_request_comment_edited(self) -> None:
expected_message = """[zura](http://139.59.64.214:7990/users/zura) edited their comment on [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)\n\n~~~ quote\nThis seems like a pretty good idea. @shimura what do you think?\n~~~"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) edited their comment on [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6):\n\n~~~ quote\nThis seems like a pretty good idea. @shimura what do you think?\n~~~"""
expected_topic = "sandbox / PR #6 sample_file: Add sample_file.txt."
self.send_and_test_stream_message("pull_request_comment_edited",
expected_topic,
expected_message)
def test_pull_request_comment_deleted(self) -> None:
expected_message = """[zura](http://139.59.64.214:7990/users/zura) deleted their comment on [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6)\n\n~~~ quote\n~~This seems like a pretty good idea. @shimura what do you think?~~\n~~~"""
expected_message = """[zura](http://139.59.64.214:7990/users/zura) deleted their comment on [PR #6](http://139.59.64.214:7990/projects/SBOX/repos/sandbox/pull-requests/6):\n\n~~~ quote\n~~This seems like a pretty good idea. @shimura what do you think?~~\n~~~"""
expected_topic = "sandbox / PR #6 sample_file: Add sample_file.txt."
self.send_and_test_stream_message("pull_request_comment_deleted",
expected_topic,