Merge pull request #603 from grafana/matiasb/fix-empty-schedule-related-users

Fix related_users for no-shifts schedule
This commit is contained in:
Matias Bordese 2022-10-03 14:39:48 -03:00 committed by GitHub
commit 802a114889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -654,6 +654,7 @@ class OnCallScheduleWeb(OnCallSchedule):
for g in rolling_groups
if g is not None
),
set(),
)
return users

View file

@ -745,6 +745,19 @@ def test_preview_override_shift(make_organization, make_user_for_organization, m
assert schedule._ical_file_overrides == schedule_overrides_ical
@pytest.mark.django_db
def test_schedule_related_users_empty_schedule(make_organization, make_schedule):
organization = make_organization()
schedule = make_schedule(
organization,
schedule_class=OnCallScheduleWeb,
name="test_web_schedule",
)
users = schedule.related_users()
assert users == set()
@pytest.mark.django_db
def test_schedule_related_users(make_organization, make_user_for_organization, make_on_call_shift, make_schedule):
organization = make_organization()