Normalize pushing tags event messages in GitLab integration.

This commit is contained in:
Tomasz Kolek
2016-11-08 22:13:23 +01:00
committed by Tim Abbott
parent 6be27a1396
commit 5980a75e07
2 changed files with 6 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ class GitlabHookTests(WebhookTestCase):
def test_add_tag_event_message(self):
# type: () -> None
expected_subject = u"my-awesome-project"
expected_message = u"Tomasz Kolek pushed xyz tag."
expected_message = u"Tomasz Kolek pushed xyz tag"
self.send_and_test_stream_message(
'add_tag',
@@ -45,7 +45,7 @@ class GitlabHookTests(WebhookTestCase):
def test_remove_tag_event_message(self):
# type: () -> None
expected_subject = u"my-awesome-project"
expected_message = u"Tomasz Kolek removed xyz tag."
expected_message = u"Tomasz Kolek removed xyz tag"
self.send_and_test_stream_message(
'remove_tag',

View File

@@ -6,7 +6,7 @@ from zerver.decorator import api_key_only_webhook_view, REQ, has_request_variabl
from zerver.lib.webhooks.git import get_push_commits_event_message, EMPTY_SHA,\
get_remove_branch_event_message, get_pull_request_event_message,\
get_issue_event_message, SUBJECT_WITH_PR_OR_ISSUE_INFO_TEMPLATE,\
get_commits_comment_action_message
get_commits_comment_action_message, get_push_tag_event_message
from zerver.models import Client, UserProfile
from django.http import HttpRequest, HttpResponse
@@ -57,10 +57,10 @@ def get_remove_branch_event_body(payload):
def get_tag_push_event_body(payload):
# type: (Dict[str, Any]) -> text_type
return u"{} {} {} tag.".format(
return get_push_tag_event_message(
get_user_name(payload),
"pushed" if payload.get('checkout_sha') else "removed",
get_tag_name(payload)
get_tag_name(payload),
action="pushed" if payload.get('checkout_sha') else "removed"
)
def get_issue_created_event_body(payload):