python: Normalize quotes with Black.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-02-11 23:20:45 -08:00
committed by Tim Abbott
parent 11741543da
commit 6e4c3e41dc
989 changed files with 32792 additions and 32792 deletions

View File

@@ -15,9 +15,9 @@ TOPIC_WIKI = "public-repo / Wiki Pages"
class GitHubWebhookTest(WebhookTestCase):
STREAM_NAME = 'github'
STREAM_NAME = "github"
URL_TEMPLATE = "/api/v1/external/github?stream={stream}&api_key={api_key}"
FIXTURE_DIR_NAME = 'github'
FIXTURE_DIR_NAME = "github"
def test_ping_event(self) -> None:
expected_message = "GitHub webhook has been successfully configured by TomaszKolek."
@@ -51,32 +51,32 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("push__1_commit_without_username", TOPIC_BRANCH, expected_message)
def test_push_1_commit_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url('master,changes')
self.url = self.build_webhook_url("master,changes")
expected_message = "baxterthehacker [pushed](https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f) 1 commit to branch changes.\n\n* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))"
self.check_webhook("push__1_commit", TOPIC_BRANCH, expected_message)
def test_push_multiple_comitters(self) -> None:
commits_info = '* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n'
commits_info = "* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n"
expected_message = f"""baxterthehacker [pushed](https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f) 6 commits to branch changes. Commits by Tomasz (3), Ben (2) and baxterthehacker (1).\n\n{commits_info * 5}* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))"""
self.check_webhook("push__multiple_committers", TOPIC_BRANCH, expected_message)
def test_push_multiple_comitters_with_others(self) -> None:
commits_info = '* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n'
commits_info = "* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n"
expected_message = f"""baxterthehacker [pushed](https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f) 10 commits to branch changes. Commits by Tomasz (4), Ben (3), James (2) and others (1).\n\n{commits_info * 9}* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))"""
self.check_webhook("push__multiple_committers_with_others", TOPIC_BRANCH, expected_message)
def test_push_multiple_comitters_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url('master,changes')
commits_info = '* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n'
self.url = self.build_webhook_url("master,changes")
commits_info = "* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n"
expected_message = f"""baxterthehacker [pushed](https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f) 6 commits to branch changes. Commits by Tomasz (3), Ben (2) and baxterthehacker (1).\n\n{commits_info * 5}* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))"""
self.check_webhook("push__multiple_committers", TOPIC_BRANCH, expected_message)
def test_push_multiple_comitters_with_others_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url('master,changes')
commits_info = '* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n'
self.url = self.build_webhook_url("master,changes")
commits_info = "* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n"
expected_message = f"""baxterthehacker [pushed](https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f) 10 commits to branch changes. Commits by Tomasz (4), Ben (3), James (2) and others (1).\n\n{commits_info * 9}* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))"""
self.check_webhook("push__multiple_committers_with_others", TOPIC_BRANCH, expected_message)
@@ -87,7 +87,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("push__50_commits", TOPIC_BRANCH, expected_message)
def test_push_50_commits_filtered_by_branches(self) -> None:
self.url = self.build_webhook_url(branches='master,changes')
self.url = self.build_webhook_url(branches="master,changes")
commit_info = "* Update README.md ([0d1a26e](https://github.com/baxterthehacker/public-repo/commit/0d1a26e67d8f5eaf1f6ba5c57fc3c7d91ac0fd1c))\n"
expected_message = f"baxterthehacker [pushed](https://github.com/baxterthehacker/public-repo/compare/9049f1265b7d...0d1a26e67d8f) 50 commits to branch changes.\n\n{commit_info * COMMITS_LIMIT}[and 30 more commit(s)]"
self.check_webhook("push__50_commits", TOPIC_BRANCH, expected_message)
@@ -126,7 +126,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("issue_comment__deleted", expected_topic, expected_message)
def test_issue_comment_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker [commented](https://github.com/baxterthehacker/public-repo/issues/2#issuecomment-99262140) on [Issue #2 Spelling error in the README file](https://github.com/baxterthehacker/public-repo/issues/2):\n\n~~~ quote\nYou are totally right! I'll get this fixed right away.\n~~~"
self.check_webhook("issue_comment", expected_topic, expected_message)
@@ -136,7 +136,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("issues", TOPIC_ISSUE, expected_message)
def test_issue_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker opened [Issue #2 Spelling error in the README file](https://github.com/baxterthehacker/public-repo/issues/2):\n\n~~~ quote\nIt looks like you accidentally spelled 'commit' with two 't's.\n~~~"
self.check_webhook("issues", expected_topic, expected_message)
@@ -167,7 +167,7 @@ class GitHubWebhookTest(WebhookTestCase):
)
def test_pull_request_opened_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker opened [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1) from `changes` to `master`:\n\n~~~ quote\nThis is a pretty simple change that we need to pull into master.\n~~~"
self.check_webhook("pull_request__opened", expected_topic, expected_message)
@@ -181,7 +181,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("pull_request__closed", TOPIC_PR, expected_message)
def test_pull_request_closed_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker closed without merge [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1)."
self.check_webhook("pull_request__closed", expected_topic, expected_message)
@@ -235,7 +235,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("pull_request_review", TOPIC_PR, expected_message)
def test_pull_request_review_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker submitted [PR Review for #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1#pullrequestreview-2626884)."
self.check_webhook("pull_request_review", expected_topic, expected_message)
@@ -245,7 +245,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("pull_request_review_comment", TOPIC_PR, expected_message)
def test_pull_request_review_comment_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker created [PR Review Comment on #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1#discussion_r29724692):\n\n~~~ quote\nMaybe you should use more emojji on this line.\n~~~"
self.check_webhook("pull_request_review_comment", expected_topic, expected_message)
@@ -271,7 +271,7 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("pull_request__assigned", TOPIC_PR, expected_message)
def test_pull_request_assigned_msg_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "baxterthehacker assigned [PR #1 Update the README with new information](https://github.com/baxterthehacker/public-repo/pull/1) to baxterthehacker."
self.check_webhook("pull_request__assigned", expected_topic, expected_message)
@@ -327,7 +327,7 @@ class GitHubWebhookTest(WebhookTestCase):
)
def test_pull_request_review_requested_with_custom_topic_in_url(self) -> None:
self.url = self.build_webhook_url(topic='notifications')
self.url = self.build_webhook_url(topic="notifications")
expected_topic = "notifications"
expected_message = "**eeshangarg** requested [showell](https://github.com/showell) for a review on [PR #1 This is just a test commit](https://github.com/eeshangarg/Scheduler/pull/1)."
self.check_webhook("pull_request__review_requested", expected_topic, expected_message)
@@ -370,7 +370,7 @@ A temporary team so that I can get some webhook fixtures!
self.assert_json_success(result)
def test_check_run_in_progress_ignore(self) -> None:
payload = self.get_body('check_run__in_progress')
payload = self.get_body("check_run__in_progress")
self.verify_post_is_ignored(payload, "check_run")
def test_ignored_pull_request_actions(self) -> None:
@@ -399,28 +399,28 @@ A temporary team so that I can get some webhook fixtures!
self.verify_post_is_ignored(payload, "team")
def test_push_1_commit_filtered_by_branches_ignore(self) -> None:
self.url = self.build_webhook_url(branches='master,development')
payload = self.get_body('push__1_commit')
self.url = self.build_webhook_url(branches="master,development")
payload = self.get_body("push__1_commit")
self.verify_post_is_ignored(payload, "push")
def test_push_50_commits_filtered_by_branches_ignore(self) -> None:
self.url = self.build_webhook_url(branches='master,development')
payload = self.get_body('push__50_commits')
self.url = self.build_webhook_url(branches="master,development")
payload = self.get_body("push__50_commits")
self.verify_post_is_ignored(payload, "push")
def test_push_multiple_comitters_filtered_by_branches_ignore(self) -> None:
self.url = self.build_webhook_url(branches='master,development')
payload = self.get_body('push__multiple_committers')
self.url = self.build_webhook_url(branches="master,development")
payload = self.get_body("push__multiple_committers")
self.verify_post_is_ignored(payload, "push")
def test_push_multiple_comitters_with_others_filtered_by_branches_ignore(self) -> None:
self.url = self.build_webhook_url(branches='master,development')
payload = self.get_body('push__multiple_committers_with_others')
self.url = self.build_webhook_url(branches="master,development")
payload = self.get_body("push__multiple_committers_with_others")
self.verify_post_is_ignored(payload, "push")
def test_repository_vulnerability_alert_ignore(self) -> None:
self.url = self.build_webhook_url()
payload = self.get_body('repository_vulnerability_alert')
payload = self.get_body("repository_vulnerability_alert")
self.verify_post_is_ignored(payload, "repository_vulnerability_alert")
def test_ignored_events(self) -> None: