webhooks: Remove repetitive argument to UnsupportedWebhookEventType.

The name of the webhook can be added by the webhook decorator.
This commit is contained in:
Alex Vandiver
2020-08-19 15:50:06 -07:00
committed by Tim Abbott
parent e2ab7b9e17
commit d04db7c5fe
30 changed files with 55 additions and 53 deletions

View File

@@ -134,7 +134,7 @@ def repo_push_branch_data(payload: Dict[str, Any], change: Dict[str, Any]) -> Di
body = get_remove_branch_event_message(user_name, branch_name)
else:
message = "{}.{}".format(payload["eventKey"], event_type) # nocoverage
raise UnsupportedWebhookEventType("BitBucket Server", message)
raise UnsupportedWebhookEventType(message)
subject = TOPIC_WITH_BRANCH_TEMPLATE.format(repo=repo_name, branch=branch_name)
return {"subject": subject, "body": body}
@@ -150,7 +150,7 @@ def repo_push_tag_data(payload: Dict[str, Any], change: Dict[str, Any]) -> Dict[
action = "removed"
else:
message = "{}.{}".format(payload["eventKey"], event_type) # nocoverage
raise UnsupportedWebhookEventType("BitBucket Server", message)
raise UnsupportedWebhookEventType(message)
subject = BITBUCKET_TOPIC_TEMPLATE.format(repository_name=repo_name)
body = get_push_tag_event_message(get_user_name(payload), tag_name, action=action)
@@ -171,7 +171,7 @@ def repo_push_handler(payload: Dict[str, Any], branches: Optional[str]=None,
data.append(repo_push_tag_data(payload, change))
else:
message = "{}.{}".format(payload["eventKey"], event_target_type) # nocoverage
raise UnsupportedWebhookEventType("BitBucket Server", message)
raise UnsupportedWebhookEventType(message)
return data
def get_assignees_string(pr: Dict[str, Any]) -> Optional[str]:
@@ -351,7 +351,7 @@ def get_event_handler(eventkey: str) -> Callable[..., List[Dict[str, str]]]:
# The main reason for this function existence is because of mypy
handler: Any = EVENT_HANDLER_MAP.get(eventkey)
if handler is None:
raise UnsupportedWebhookEventType("BitBucket Server", eventkey)
raise UnsupportedWebhookEventType(eventkey)
return handler
@webhook_view("Bitbucket3")