|
8 | 8 |
|
9 | 9 | from apps.slack.scenarios.manage_responders import ManageRespondersUserChange
|
10 | 10 | from apps.slack.scenarios.paging import OnPagingTeamChange
|
| 11 | +from apps.slack.scenarios.schedules import EditScheduleShiftNotifyStep |
11 | 12 | from apps.slack.scenarios.shift_swap_requests import AcceptShiftSwapRequestStep
|
12 | 13 | from apps.slack.types import PayloadType
|
13 | 14 |
|
@@ -200,6 +201,37 @@ def test_organization_not_found_scenario_doesnt_break_manage_responders(
|
200 | 201 | mock_process_scenario.assert_called_once()
|
201 | 202 |
|
202 | 203 |
|
| 204 | +@patch("apps.slack.views.SlackEventApiEndpointView.verify_signature", return_value=True) |
| 205 | +@patch.object(EditScheduleShiftNotifyStep, "process_scenario") |
| 206 | +@pytest.mark.django_db |
| 207 | +def test_organization_not_found_scenario_doesnt_break_edit_schedule_notifications( |
| 208 | + mock_edit_schedule_notifications, |
| 209 | + _, |
| 210 | + make_organization, |
| 211 | + make_slack_user_identity, |
| 212 | + make_user, |
| 213 | + slack_team_identity, |
| 214 | +): |
| 215 | + """ |
| 216 | + Check EditScheduleShiftNotifyStep.process_scenario gets called when a user clicks settings in shift notification. |
| 217 | + """ |
| 218 | + organization = make_organization(slack_team_identity=slack_team_identity) |
| 219 | + slack_user_identity = make_slack_user_identity(slack_team_identity=slack_team_identity, slack_id=SLACK_USER_ID) |
| 220 | + make_user(organization=organization, slack_user_identity=slack_user_identity) |
| 221 | + |
| 222 | + response = _make_request( |
| 223 | + { |
| 224 | + "team_id": SLACK_TEAM_ID, |
| 225 | + "user_id": SLACK_USER_ID, |
| 226 | + "type": "block_actions", |
| 227 | + "actions": [{"action_id": EditScheduleShiftNotifyStep.routing_uid(), "type": "button"}], |
| 228 | + } |
| 229 | + ) |
| 230 | + |
| 231 | + assert response.status_code == status.HTTP_200_OK |
| 232 | + mock_edit_schedule_notifications.assert_called_once() |
| 233 | + |
| 234 | + |
203 | 235 | @patch("apps.slack.views.SlackEventApiEndpointView.verify_signature", return_value=True)
|
204 | 236 | @patch.object(AcceptShiftSwapRequestStep, "process_scenario")
|
205 | 237 | @pytest.mark.django_db
|
|
0 commit comments