oncall-engine/engine/apps/public_api/tests
Joey Orlando 4a5c4263e0
feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199)
# What this PR does

`OnCallSchedule` equivalent of
https://github.com/grafana/oncall/pull/5191.

**NOTE**: merge after https://github.com/grafana/oncall/pull/5224 (so
that I can use some of the new serializer fields defined in there)

### Migration
```bash
Running migrations:                                                                                                                                                                                                │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Starting migration to populate slack_channel field.                                                                │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Total schedules to process: 1                                                                                      │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Schedule 26 updated with SlackChannel 2 (slack_id: C043LL6RTS7).                                                   │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Bulk updated 1 OnCallSchedules with their Slack channel.                                                           │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Finished migration. Total schedules processed: 1. Schedules updated: 1. Missing SlackChannels: 0.                  │
│   Applying schedules.0019_auto_20241021_1735... OK
```

### Tested Public API
```txt
POST {{oncall_host}}/api/v1/schedules/
Authorization: {{oncall_api_key}}
Content-Type: application/json

{
    "name": "Demo testy testy2",
    "type": "web",
    "time_zone": "America/Los_Angeles",
    "slack": {
        "channel_id": "C05PPLYN1U1"
    }
}

HTTP/1.1 201 Created
Content-Type: application/json
Vary: Accept, Origin
Allow: GET, POST, HEAD, OPTIONS
X-Frame-Options: DENY
Content-Length: 198
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Cross-Origin-Opener-Policy: same-origin

{
  "id": "SBBN73UTUTVCE",
  "team_id": null,
  "name": "Demo testy testy2",
  "time_zone": "America/Los_Angeles",
  "on_call_now": [],
  "shifts": [],
  "slack": {
    "channel_id": "C05PPLYN1U1",
    "user_group_id": null
  },
  "type": "web"
}
```

### Tested via UI (eg; internal API)

https://www.loom.com/share/e66bf3468b144dd782da5eb6e0bfd0af

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-11-04 14:27:21 -05:00
..
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
test_alert_groups.py Add latest alert to public api alert groups endpoint (#5059) 2024-10-02 17:09:50 +00:00
test_alerts.py augment API response pagination attributes (#2471) 2023-07-14 11:19:40 -04:00
test_custom_actions.py Migrate webhooks integration_filter to use a m2m field instead (#3946) 2024-02-23 11:55:44 +00:00
test_escalation.py update URLs constructed by the backend to support IRM plugin (#5137) 2024-10-09 08:55:10 -04:00
test_escalation_chain.py augment API response pagination attributes (#2471) 2023-07-14 11:19:40 -04:00
test_escalation_policies.py Reworked declare incident escalation step (#5130) 2024-10-07 19:26:10 +00:00
test_integrations.py Fix validation of integration name when team is not present in request data (#4132) 2024-03-29 04:57:27 +00:00
test_maintenance.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
test_on_call_shifts.py fix: Add rolling users validation for oncall shift API (#5050) 2024-09-20 21:06:33 +00:00
test_personal_notification_rules.py augment API response pagination attributes (#2471) 2023-07-14 11:19:40 -04:00
test_ratelimit.py Use dataclass methods in custom ratelimits and fix tests (#5036) 2024-09-18 13:32:16 +00:00
test_rbac_permissions.py Enable RBAC support for public API endpoints (#5211) 2024-10-30 09:54:55 +00:00
test_resolution_notes.py fix: don't update Slack messages if resolution note text not changed (#5126) 2024-10-04 16:47:18 +00:00
test_routes.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
test_schedule_export.py upgrade flake8 to v7 (#4141) 2024-04-02 14:26:19 +00:00
test_schedules.py feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
test_shift_swap.py Update Makefile dev bootstrap; fix test (#4582) 2024-06-25 14:43:50 +00:00
test_slack_channels.py augment API response pagination attributes (#2471) 2023-07-14 11:19:40 -04:00
test_teams.py feat: add Grafana IDs to users and teams public API endpoints (#5075) 2024-09-24 19:16:22 +00:00
test_user_groups.py augment API response pagination attributes (#2471) 2023-07-14 11:19:40 -04:00
test_users.py feat: add Grafana IDs to users and teams public API endpoints (#5075) 2024-09-24 19:16:22 +00:00
test_webhooks.py Allow webhook modification by API for advanced webhook (#4175) 2024-04-23 19:18:12 +00:00