Skip to content

Commit

Permalink
Formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviamclaughlin authored Apr 11, 2024
1 parent f421107 commit 7ca7e9c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
5 changes: 2 additions & 3 deletions app/jobs/notify_stale_incident_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def notify_stale_incident_channels(client):
Bonjour! Il n'y a pas eu de mise à jour dans ce canal d'incident depuis 14 jours. Pensez à planifier une rétro ou à l'archiver."""
attachments = [
{
"text": "Would you like to archive the channel now or schedule a retro? | Souhaitez-vous archiver la chaîne maintenant ou programmer une rétro?",
"text": "Would you like to archive the channel now or schedule a retro? | Souhaitez-vous archiver la chaîne maintenant ou programmer une rétro?",
"fallback": "You are unable to archive the channel | Vous ne pouvez pas archiver ce canal",
"callback_id": "archive_channel",
"color": "#3AA3E3",
Expand Down Expand Up @@ -47,6 +47,5 @@ def notify_stale_incident_channels(client):
for channel in channels:
log_to_sentinel("sent_stale_channel_notification", {"channel": channel})
client.chat_postMessage(
#channel=channel["id"], text=text, attachments=attachments
channel="C06TVP0V5AR", text=text, attachments=attachments
channel=channel["id"], text=text, attachments=attachments
)
10 changes: 6 additions & 4 deletions app/modules/incident/incident_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@ def archive_channel_action(client, body, ack):
# get the current chanel id and name and make up the body with those 2 values
channel_info = {
"channel_id": channel_id,
"channel_name": channel_name,
"channel_name": channel_name,
"user_id": user,
"trigger_id": body["trigger_id"],
}

if action == "ignore":
msg = f"<@{user}> has delayed scheduling and archiving this channel for 14 days."
msg = (
f"<@{user}> has delayed scheduling and archiving this channel for 14 days."
)
client.chat_update(
channel=channel_id, text=msg, ts=body["message_ts"], attachments=[]
)
Expand All @@ -152,6 +153,7 @@ def archive_channel_action(client, body, ack):
# log the event to sentinel
log_to_sentinel("incident_channel_archived", body)
elif action == "schedule_retro":
channel_info["trigger_id"] = body["trigger_id"]
schedule_incident_retro(client, channel_info, ack)
# log the event to sentinel
log_to_sentinel("incident_retro_scheduled", body)
Expand Down
4 changes: 2 additions & 2 deletions app/tests/jobs/test_notify_stale_incident_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_notify_stale_incident_channels(_log_to_sentinel_mock, get_stale_channel
text="👋 Hi! There have been no updates in this incident channel for 14 days! Consider scheduling a retro or archiving it.\n\n Bonjour! Il n'y a pas eu de mise à jour dans ce canal d'incident depuis 14 jours. Pensez à planifier une rétro ou à l'archiver.",
attachments=[
{
"text": "Would you like to archive the channel now or schedule a retro? | Souhaitez-vous archiver la chaîne maintenant ou programmer une rétro?",
"text": "Would you like to archive the channel now or schedule a retro? | Souhaitez-vous archiver la chaîne maintenant ou programmer une rétro?",
"fallback": "You are unable to archive the channel | Vous ne pouvez pas archiver ce canal",
"callback_id": "archive_channel",
"color": "#3AA3E3",
Expand All @@ -31,7 +31,7 @@ def test_notify_stale_incident_channels(_log_to_sentinel_mock, get_stale_channel
"name": "schedule_retro",
"text": "Schedule Retro | Calendrier rétro",
"type": "button",
"value": "archive",
"value": "schedule_retro",
"style": "primary",
},
{
Expand Down
22 changes: 7 additions & 15 deletions app/tests/modules/incident/test_incident_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,19 @@ def test_archive_channel_action_archive(


@patch("modules.incident.incident_helper.log_to_sentinel")
def test_archive_channel_action_schedule_incident(
mock_log_to_sentinel
):
def test_archive_channel_action_schedule_incident(mock_log_to_sentinel):
client = MagicMock()
body = {
"actions": [{"value": "schedule_retro"}],
channel_info = {
"channel_id": "channel_id",
"channel_name": "channel_name",
"channel": {"id": "channel_id", "name": "incident-2024-01-12-test"},
"message_ts": "message_ts",
"user": {"id": "user_id"},
"user_id": "user_id",
}
channel_info = {
"channel_id": "channel_id",
"channel_name": "channel_name",
"channel": {"id": "channel_id", "name": "incident-2024-01-12-test"},
"user_id": "user_id",
}
ack = MagicMock()
incident_helper.schedule_incident_retro(client, channel_info, ack)
assert ack.call_count == 1


@patch("modules.incident.incident_helper.google_drive.delete_metadata")
@patch("modules.incident.incident_helper.view_folder_metadata")
def test_delete_folder_metadata(view_folder_metadata_mock, delete_metadata_mock):
Expand Down

0 comments on commit 7ca7e9c

Please sign in to comment.