-
Notifications
You must be signed in to change notification settings - Fork 513
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes listing empty incidents in Slack.
- Loading branch information
1 parent
274aa0f
commit 2a55c3c
Showing
6 changed files
with
103 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
def test_configure(): | ||
"""Test that we can configure the plugin.""" | ||
from dispatch.plugins.dispatch_slack.incident.interactive import ( | ||
configure, | ||
) | ||
from easydict import EasyDict | ||
|
||
config = EasyDict( | ||
{ | ||
"api_bot_token": "xoxb-12345", | ||
"socket_mode_app_token": "xapp-12345", | ||
"signing_secret": "test-123", | ||
"app_user_slug": "test", | ||
"ban_threads": True, | ||
"timeline_event_reaction": "stopwatch", | ||
"slack_command_tasks": "/dispatch-list-tasks", | ||
"slack_command_list_my_tasks": "/dispatch-list-my-tasks", | ||
"slack_command_list_participants": "/dispatch-list-participants", | ||
"slack_command_assign_role": "/dispatch-assign-role", | ||
"slack_command_update_incident": "/dispatch-update-incident", | ||
"slack_command_update_participant": "/dispatch-update-participant", | ||
"slack_command_engage_oncall": "/dispatch-engage-oncall", | ||
"slack_command_list_resource": "/dispatch-list-resources", | ||
"slack_command_report_incident": "/dispatch-report-incident", | ||
"slack_command_report_tactical": "/dispatch-report-tactical", | ||
"slack_command_report_executive": "/dispatch-report-executive", | ||
"slack_command_update_notifications_group": "/dispatch-notifications-group", | ||
"slack_command_add_timeline_event": "/dispatch-add-timeline-event", | ||
"slack_command_list_incidents": "/dispatch-list-incidents", | ||
"slack_command_run_workflow": "/dispatch-run-workflow", | ||
"slack_command_list_workflow": "/dispatch-list-workflows", | ||
"slack_command_list_tasks": "/dispatch-list-tasks", | ||
"slack_command_create_task": "/dispatch-create-task", | ||
} | ||
) | ||
|
||
configure(config) | ||
|
||
|
||
def test_handle_tag_search_action(session, incident): | ||
from dispatch.plugins.dispatch_slack.incident.interactive import ( | ||
handle_tag_search_action, | ||
) | ||
from slack_bolt import Ack | ||
from easydict import EasyDict | ||
|
||
bolt_context = EasyDict({"subject": incident}) | ||
payload = {"value": "payload"} | ||
|
||
handle_tag_search_action(ack=Ack(), payload=payload, context=bolt_context, db_session=session) | ||
|
||
|
||
def test_handle_list_incidents_command(session, incident, mock_slack_client): | ||
"""Test that we can handle the list incidents command.""" | ||
from dispatch.plugins.dispatch_slack.incident.interactive import ( | ||
handle_list_incidents_command, | ||
) | ||
from slack_bolt import Ack | ||
from easydict import EasyDict | ||
from dispatch.plugins.dispatch_slack.models import SubjectMetadata, IncidentSubjects | ||
|
||
subject = SubjectMetadata( | ||
type=IncidentSubjects.incident, | ||
id=incident.id, | ||
organization_slug=incident.project.slug, | ||
project_id=incident.project.id, | ||
) | ||
|
||
bolt_context = EasyDict({"subject": subject, "db_session": session}) | ||
body = EasyDict({"trigger_id": "trigger_id"}) | ||
payload = {"value": "payload"} | ||
|
||
handle_list_incidents_command( | ||
ack=Ack(), | ||
body=body, | ||
payload=payload, | ||
context=bolt_context, | ||
db_session=session, | ||
client=mock_slack_client, | ||
) |