# Which issue(s) this PR fixes We've been seeing this `AttributeError` quite frequently for quite some time ([logs](https://ops.grafana-ops.net/explore?schemaVersion=1&panes=%7B%22oPl%22:%7B%22datasource%22:%22000000193%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D~%5C%22prod-%28eu-west-0%7Cus-central-0%29%5C%22,%20namespace%3D%5C%22amixr-prod%5C%22%7D%20%7C%3D%20%60AttributeError%28%5C%22module%20%27apps.schedules.tasks.notify_about_empty_shifts_in_schedule%27%20has%20no%20attribute%20%27apply_async%27%5C%22%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22000000193%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-7d%22,%22to%22:%22now%22%7D%7D%7D&orgId=1)) ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
16 lines
584 B
Python
16 lines
584 B
Python
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
from apps.schedules.models import OnCallScheduleWeb
|
|
from apps.schedules.tasks.drop_cached_ical import drop_cached_ical_task
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_drop_cached_ical_triggers_final_refresh(make_organization, make_schedule):
|
|
organization = make_organization()
|
|
schedule = make_schedule(organization, schedule_class=OnCallScheduleWeb)
|
|
|
|
with patch("apps.schedules.tasks.refresh_ical_final_schedule") as mock_refresh_final:
|
|
drop_cached_ical_task(schedule.pk)
|
|
assert mock_refresh_final.apply_async.called
|