2016-09-20 22:51:11 +02:00
# -*- coding: utf-8 -*-
2016-12-04 18:38:56 +01:00
from typing import Text
2016-11-10 19:30:09 +01:00
from zerver . lib . test_classes import WebhookTestCase
2016-09-20 22:51:11 +02:00
class TaigaHookTests ( WebhookTestCase ) :
STREAM_NAME = ' taiga '
TOPIC = " subject "
2017-04-21 23:35:40 +02:00
URL_TEMPLATE = u " /api/v1/external/taiga?stream= {stream} &api_key= {api_key} "
2016-09-20 22:51:11 +02:00
FIXTURE_DIR_NAME = ' taiga '
2017-04-21 23:35:40 +02:00
def setUp ( self ) :
# type: () -> None
self . url = self . build_webhook_url ( topic = self . TOPIC )
2016-09-20 22:51:11 +02:00
def test_taiga_userstory_deleted ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :x: TomaszKolek deleted user story **New userstory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_deleted " , u ' subject ' , message )
def test_taiga_userstory_created ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :package: TomaszKolek created user story **New userstory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_created " , u ' subject ' , message )
def test_taiga_userstory_changed_unblocked ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :unlock: TomaszKolek unblocked user story **UserStory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_unblocked " , u ' subject ' , message )
def test_taiga_userstory_changed_subject ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek renamed user story from UserStory to **UserStoryNewSubject**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_subject " , u ' subject ' , message )
def test_taiga_userstory_changed_status ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from Ready to In progress. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_status " , u ' subject ' , message )
def test_taiga_userstory_changed_reassigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek reassigned user story **UserStory** from TomaszKolek to HanSolo. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_reassigned " , u ' subject ' , message )
2017-01-10 19:22:26 +01:00
def test_taiga_userstory_changed_unassigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek unassigned user story **UserStory**. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " userstory_changed_unassigned " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
def test_taiga_userstory_changed_points ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :game_die: TomaszKolek changed estimation of user story **UserStory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_points " , u ' subject ' , message )
2017-01-10 19:22:26 +01:00
def test_taiga_userstory_changed_new_sprint ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :calendar: TomaszKolek added user story **UserStory** to sprint Sprint1. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " userstory_changed_new_sprint " , u ' subject ' , message )
def test_taiga_userstory_changed_sprint ( self ) :
2016-09-20 22:51:11 +02:00
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :calendar: TomaszKolek changed sprint of user story **UserStory** from Sprint1 to Sprint2. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " userstory_changed_sprint " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
2017-01-10 19:22:26 +01:00
def test_taiga_userstory_changed_remove_sprint ( self ) :
2016-09-20 22:51:11 +02:00
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :calendar: TomaszKolek removed user story **UserStory** from sprint Sprint2. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " userstory_changed_remove_sprint " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
def test_taiga_userstory_changed_description ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek updated description of user story **UserStory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_description " , u ' subject ' , message )
def test_taiga_userstory_changed_closed ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from New to Done. \n :checkered_flag: TomaszKolek closed user story **UserStory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_closed " , u ' subject ' , message )
def test_taiga_userstory_changed_reopened ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from Done to Ready. \n :package: TomaszKolek reopened user story **UserStory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_reopened " , u ' subject ' , message )
def test_taiga_userstory_changed_blocked ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :lock: TomaszKolek blocked user story **UserStory**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_blocked " , u ' subject ' , message )
def test_taiga_userstory_changed_assigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek assigned user story **UserStory** to TomaszKolek. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " userstory_changed_assigned " , u ' subject ' , message )
2017-01-10 19:22:26 +01:00
def test_taiga_userstory_comment_added ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :thought_balloon: TomaszKolek commented on user story **UserStory**. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " userstory_changed_comment_added " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
def test_taiga_task_created ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :clipboard: TomaszKolek created task **New Task**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_created " , u ' subject ' , message )
def test_taiga_task_changed_status ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :chart_with_upwards_trend: TomaszKolek changed status of task **New Task** from New to In progress. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_status " , u ' subject ' , message )
def test_taiga_task_changed_blocked ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :lock: TomaszKolek blocked task **New Task**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_blocked " , u ' subject ' , message )
def test_taiga_task_changed_unblocked ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :unlock: TomaszKolek unblocked task **New Task**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_unblocked " , u ' subject ' , message )
def test_taiga_task_changed_assigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek assigned task **New Task** to TomaszKolek. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_assigned " , u ' subject ' , message )
def test_taiga_task_changed_reassigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek reassigned task **New Task** from HanSolo to TomaszKolek. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_reassigned " , u ' subject ' , message )
def test_taiga_task_changed_subject ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek renamed task New Task to **New Task Subject**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_subject " , u ' subject ' , message )
def test_taiga_task_changed_description ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek updated description of task **New Task**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_changed_description " , u ' subject ' , message )
def test_taiga_task_deleted ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :x: TomaszKolek deleted task **New Task**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " task_deleted " , u ' subject ' , message )
2017-01-10 19:22:26 +01:00
def test_taiga_task_changed_comment_added ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :thought_balloon: TomaszKolek commented on task **New Task**. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " task_changed_comment_added " , u ' subject ' , message )
def test_taiga_sprint_created ( self ) :
2016-09-20 22:51:11 +02:00
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :calendar: TomaszKolek created sprint **New sprint**. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " sprint_created " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
2017-01-10 19:22:26 +01:00
def test_taiga_sprint_deleted ( self ) :
2016-09-20 22:51:11 +02:00
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :x: TomaszKolek deleted sprint **New name**. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " sprint_deleted " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
2017-01-10 19:22:26 +01:00
def test_taiga_sprint_changed_time ( self ) :
2016-09-20 22:51:11 +02:00
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :calendar: TomaszKolek changed estimated finish of sprint **New sprint** from 2017-01-24 to 2017-01-25. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " sprint_changed_time " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
2017-01-10 19:22:26 +01:00
def test_taiga_sprint_changed_name ( self ) :
2016-09-20 22:51:11 +02:00
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek renamed sprint from New sprint to **New name**. '
2017-01-10 19:22:26 +01:00
self . send_and_test_stream_message ( " sprint_changed_name " , u ' subject ' , message )
2016-09-20 22:51:11 +02:00
def test_taiga_issue_created ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :bulb: TomaszKolek created issue **New issue**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_created " , u ' subject ' , message )
def test_taiga_issue_deleted ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :x: TomaszKolek deleted issue **New issue**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_deleted " , u ' subject ' , message )
def test_taiga_issue_changed_assigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek assigned issue **New issue** to TomaszKolek. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_assigned " , u ' subject ' , message )
def test_taiga_issue_changed_reassigned ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :busts_in_silhouette: TomaszKolek reassigned issue **New issue** from TomaszKolek to HanSolo. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_reassigned " , u ' subject ' , message )
def test_taiga_issue_changed_subject ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek renamed issue New issue to **New issueNewSubject**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_subject " , u ' subject ' , message )
def test_taiga_issue_changed_description ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :notebook: TomaszKolek updated description of issue **New issue**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_description " , u ' subject ' , message )
def test_taiga_issue_changed_type ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :bulb: TomaszKolek changed type of issue **New issue** from Bug to Question. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_type " , u ' subject ' , message )
def test_taiga_issue_changed_status ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :chart_with_upwards_trend: TomaszKolek changed status of issue **New issue** from New to In progress. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_status " , u ' subject ' , message )
def test_taiga_issue_changed_severity ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :warning: TomaszKolek changed severity of issue **New issue** from Normal to Minor. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_severity " , u ' subject ' , message )
def test_taiga_issue_changed_priority ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :rocket: TomaszKolek changed priority of issue **New issue** from Normal to Low. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_priority " , u ' subject ' , message )
def test_taiga_issue_changed_comment_added ( self ) :
# type: () -> None
2017-02-12 04:22:13 +01:00
message = u ' :thought_balloon: TomaszKolek commented on issue **New issue**. '
2016-09-20 22:51:11 +02:00
self . send_and_test_stream_message ( " issue_changed_comment_added " , u ' subject ' , message )