oncall-engine/engine/common/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_apply_jinja_template.py feat: add timedeltaparse function to the jinja template (#5142) 2024-10-09 18:27:48 +00:00
test_cache.py patch redis cluster multi-key operations (#3496) 2023-12-04 13:08:57 -05:00
test_create_engine_url.py Use utility function to create URLs 2022-07-12 15:42:20 -06:00
test_custom_fields.py feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
test_database.py Add utility function to get readonly db key if defined (#1264) 2023-02-01 12:07:32 +01:00
test_l10n.py add user locale field to mobile app user settings table + change going on call push notification text (#2131) 2023-06-14 12:19:58 -04:00
test_markup.py Fix cuddled list Markdown issue (#2488) 2023-07-11 09:14:52 +00:00
test_ordered_model.py Address deprecation warnings in tests (#4681) 2024-08-13 20:51:18 +00:00
test_recaptcha.py Add validation of hostname for recapctha (#1445) 2023-03-06 08:59:48 +00:00
test_regex_replace.py linting and fixed test 2022-07-14 20:06:24 +10:00
test_task_queue_assignment.py add more logging on celery task retry (#3695) 2024-01-16 07:13:16 -05:00
test_timezones.py shift swap requests model + CRUD endpoints (#2597) 2023-07-21 19:35:19 +00:00
test_urlize.py Fix warnings when running backend tests (#2079) 2023-06-06 18:38:00 +00:00
test_viewset_actions.py Integration webhooks API (#3954) 2024-02-27 08:12:21 +00:00