diff --git a/taiga/github_hook/event_hooks.py b/taiga/github_hook/event_hooks.py index 10e7c6e1..e91b17da 100644 --- a/taiga/github_hook/event_hooks.py +++ b/taiga/github_hook/event_hooks.py @@ -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) diff --git a/tests/integration/test_github_hook.py b/tests/integration/test_github_hook.py index d218c6eb..a5d25122 100644 --- a/tests/integration/test_github_hook.py +++ b/tests/integration/test_github_hook.py @@ -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": [