webhooks: Migrate bitbucket3 tests to the headers fixtures system.

This commit is contained in:
Hemanth V. Alluri 2019-07-04 22:29:22 +05:30 committed by Tim Abbott
parent f5b1081c93
commit 62bcbb433d
2 changed files with 4 additions and 4 deletions

View File

@ -13,16 +13,14 @@ class Bitbucket3HookTests(WebhookTestCase):
expected_message = "Congratulations! The Bitbucket Server webhook was configured successfully!"
self.send_and_test_stream_message("diagnostics_ping",
"Bitbucket Server Ping",
expected_message,
HTTP_X_EVENT_KEY="diagnostics:ping")
expected_message)
def test_ping_with_user_defined_topic(self) -> None:
self.url = self.build_webhook_url(topic="my topic")
expected_message = "Congratulations! The Bitbucket Server webhook was configured successfully!"
self.send_and_test_stream_message("diagnostics_ping",
"my topic",
expected_message,
HTTP_X_EVENT_KEY="diagnostics:ping")
expected_message)
# Core Repo Events:
def test_commit_comment_added(self) -> None:

View File

@ -41,6 +41,8 @@ PULL_REQUEST_OPENED_OR_MODIFIED_TEMPLATE_WITH_REVIEWERS_WITH_TITLE = """
`{destination}` (assigned to {assignees} for review)
""".strip()
fixture_to_headers = lambda x: {"HTTP_X_EVENT_KEY": "diagnostics:ping"} if x == "diagnostics_ping" else None
def get_user_name(payload: Dict[str, Any]) -> str:
user_name = "[{name}]({url})".format(name=payload["actor"]["name"],
url=payload["actor"]["links"]["self"][0]["href"])