From 0292ffe04bd6feedaa721dd5518a73b1899c8dcd Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Tue, 16 Oct 2018 16:16:22 -0230 Subject: [PATCH] webhooks/taiga: Add test for when a task is moved between stories. This commit adds a test for the payload that is generated when a Task is moved from one user story to another on Taiga's Sprint Taskboard UI. This commit also gets up this webhook's test coverage up to 100%. --- tools/test-backend | 1 - .../fixtures/task_changed_user_stories.json | 208 ++++++++++++++++++ zerver/webhooks/taiga/tests.py | 4 + 3 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 zerver/webhooks/taiga/fixtures/task_changed_user_stories.json diff --git a/tools/test-backend b/tools/test-backend index fe3672f412..929f4e7c7e 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -107,7 +107,6 @@ not_yet_fully_covered = { 'zerver/webhooks/pivotal/view.py', 'zerver/webhooks/semaphore/view.py', 'zerver/webhooks/solano/view.py', - 'zerver/webhooks/taiga/view.py', 'zerver/webhooks/teamcity/view.py', 'zerver/webhooks/travis/view.py', 'zerver/webhooks/zapier/view.py', diff --git a/zerver/webhooks/taiga/fixtures/task_changed_user_stories.json b/zerver/webhooks/taiga/fixtures/task_changed_user_stories.json new file mode 100644 index 0000000000..447c45cdd7 --- /dev/null +++ b/zerver/webhooks/taiga/fixtures/task_changed_user_stories.json @@ -0,0 +1,208 @@ +{ + "type":"task", + "action":"change", + "date":"2018-10-16T18:36:27.132Z", + "data":{ + "due_date_reason":"", + "id":2541359, + "blocked_note":"", + "custom_attributes_values":{ + + }, + "tags":[ + + ], + "subject":"Get this task done", + "watchers":[ + + ], + "external_reference":null, + "project":{ + "id":229096, + "name":"Zulip", + "logo_big_url":null, + "permalink":"https://tree.taiga.io/project/eeshangarg-zulip" + }, + "owner":{ + "full_name":"Eeshan Garg", + "id":258659, + "photo":null, + "permalink":"https://tree.taiga.io/profile/eeshangarg", + "gravatar_id":"cd181af88d928dab53c55600c9f7551d", + "username":"eeshangarg" + }, + "assigned_to":null, + "us_order":0, + "finished_date":null, + "modified_date":"2018-10-16T18:36:26.986Z", + "due_date":null, + "description":"", + "user_story":{ + "due_date_reason":"", + "id":1825616, + "tribe_gig":null, + "finish_date":null, + "custom_attributes_values":{ + + }, + "tags":[ + + ], + "subject":"A related user story, which is epic", + "watchers":[ + + ], + "external_reference":null, + "owner":{ + "full_name":"Eeshan Garg", + "id":258659, + "photo":null, + "permalink":"https://tree.taiga.io/profile/eeshangarg", + "gravatar_id":"cd181af88d928dab53c55600c9f7551d", + "username":"eeshangarg" + }, + "assigned_to":null, + "modified_date":"2018-10-16T18:36:10.637Z", + "status":{ + "color":"#999999", + "id":1364773, + "slug":"new", + "is_archived":false, + "is_closed":false, + "name":"New" + }, + "is_closed":false, + "is_blocked":false, + "team_requirement":false, + "project":{ + "id":229096, + "name":"Zulip", + "logo_big_url":null, + "permalink":"https://tree.taiga.io/project/eeshangarg-zulip" + }, + "blocked_note":"", + "due_date":null, + "assigned_users":[ + + ], + "description":"", + "milestone":{ + "slug":"another-one-4", + "closed":false, + "project":{ + "id":229096, + "name":"Zulip", + "logo_big_url":null, + "permalink":"https://tree.taiga.io/project/eeshangarg-zulip" + }, + "estimated_start":"2018-10-25", + "owner":{ + "full_name":"Eeshan Garg", + "id":258659, + "photo":null, + "permalink":"https://tree.taiga.io/profile/eeshangarg", + "gravatar_id":"cd181af88d928dab53c55600c9f7551d", + "username":"eeshangarg" + }, + "estimated_finish":"2018-11-03", + "created_date":"2018-10-16T18:35:57.020Z", + "modified_date":"2018-10-16T18:35:57.040Z", + "disponibility":0.0, + "id":206232, + "name":"Another one" + }, + "generated_from_issue":null, + "client_requirement":false, + "points":[ + { + "role":"UX", + "name":"?", + "value":null + }, + { + "role":"Design", + "name":"?", + "value":null + }, + { + "role":"Front", + "name":"?", + "value":null + }, + { + "role":"Back", + "name":"?", + "value":null + } + ], + "ref":8, + "created_date":"2017-10-25T00:42:40.254Z" + }, + "taskboard_order":0, + "is_blocked":false, + "milestone":{ + "slug":"another-one-4", + "closed":false, + "project":{ + "id":229096, + "name":"Zulip", + "logo_big_url":null, + "permalink":"https://tree.taiga.io/project/eeshangarg-zulip" + }, + "estimated_start":"2018-10-25", + "owner":{ + "full_name":"Eeshan Garg", + "id":258659, + "photo":null, + "permalink":"https://tree.taiga.io/profile/eeshangarg", + "gravatar_id":"cd181af88d928dab53c55600c9f7551d", + "username":"eeshangarg" + }, + "estimated_finish":"2018-11-03", + "created_date":"2018-10-16T18:35:57.020Z", + "modified_date":"2018-10-16T18:35:57.040Z", + "disponibility":0.0, + "id":206232, + "name":"Another one" + }, + "status":{ + "color":"#999999", + "id":1148067, + "name":"New", + "slug":"new", + "is_closed":false + }, + "is_iocaine":false, + "ref":10, + "created_date":"2018-10-16T18:30:26.769Z" + }, + "by":{ + "full_name":"Eeshan Garg", + "id":258659, + "photo":null, + "permalink":"https://tree.taiga.io/profile/eeshangarg", + "gravatar_id":"cd181af88d928dab53c55600c9f7551d", + "username":"eeshangarg" + }, + "change":{ + "edit_comment_date":null, + "diff":{ + "user_story":{ + "from":"#7 Yaar ne scirra!", + "to":"#8 A related user story, which is epic" + }, + "milestone":{ + "from":null, + "to":"Another one" + }, + "taskboard_order":{ + "from":1539714626735, + "to":0 + } + }, + "comment_versions":null, + "comment_html":"", + "comment":"", + "delete_comment_date":null + } +} diff --git a/zerver/webhooks/taiga/tests.py b/zerver/webhooks/taiga/tests.py index 2a9ed7afec..78aee0315e 100644 --- a/zerver/webhooks/taiga/tests.py +++ b/zerver/webhooks/taiga/tests.py @@ -82,6 +82,10 @@ class TaigaHookTests(WebhookTestCase): message = u':clipboard: TomaszKolek created task **New Task**.' self.send_and_test_stream_message("task_created", u'subject', message) + def test_taiga_task_changed_user_stories(self) -> None: + message = u':calendar: Eeshan Garg added task **Get this task done** to sprint Another one.\n:clipboard: Eeshan Garg moved task **Get this task done** from user story #7 Yaar ne scirra! to #8 A related user story, which is epic.' + self.send_and_test_stream_message("task_changed_user_stories", u'subject', message) + def test_taiga_task_changed_status(self) -> None: message = u':chart_with_upwards_trend: TomaszKolek changed status of task **New Task** from New to In progress.' self.send_and_test_stream_message("task_changed_status", u'subject', message)