Making commit message actions case insensitive

remotes/origin/enhancement/email-actions
Alejandro Alonso 2014-11-06 13:41:28 +01:00 committed by David Barragán Merino
parent 63cf345ff0
commit 2d90a5dac9
2 changed files with 20 additions and 2 deletions

View File

@ -63,8 +63,8 @@ class PushEventHook(BaseEventHook):
if message is None:
return
p = re.compile("TG-(\d+) +#([-\w]+)")
m = p.search(message)
p = re.compile("tg-(\d+) +#([-\w]+)")
m = p.search(message.lower())
if m:
ref = m.group(1)
status_slug = m.group(2)

View File

@ -128,6 +128,24 @@ def test_push_event_user_story_processing(client):
assert len(mail.outbox) == 1
def test_push_event_processing_case_insensitive(client):
creation_status = f.TaskStatusFactory()
new_status = f.TaskStatusFactory(project=creation_status.project)
task = f.TaskFactory.create(status=creation_status, project=creation_status.project)
payload = {"commits": [
{"message": """test message
test tg-%s #%s ok
bye!
"""%(task.ref, new_status.slug.upper())},
]}
mail.outbox = []
ev_hook = event_hooks.PushEventHook(task.project, payload)
ev_hook.process_event()
task = Task.objects.get(id=task.id)
assert task.status.id == new_status.id
assert len(mail.outbox) == 1
def test_push_event_bad_processing_non_existing_ref(client):
issue_status = f.IssueStatusFactory()
payload = {"commits": [