def METHOD_NAME(
    django_capture_on_commit_callbacks,
):
    ds1, ds2 = DisplaySetFactory.create_batch(2)
    im = ImageFactory()
    civ = ComponentInterfaceValueFactory(image=im)
    with django_capture_on_commit_callbacks(execute=True):
        ds1.values.set([civ])
        ds2.values.set([civ])
    assert get_groups_with_set_perms(im) == {
        ds1.reader_study.editors_group: {"view_image"},
        ds1.reader_study.readers_group: {"view_image"},
        ds2.reader_study.editors_group: {"view_image"},
        ds2.reader_study.readers_group: {"view_image"},
    }
    with django_capture_on_commit_callbacks(execute=True):
        ds1.delete()
    assert get_groups_with_set_perms(im) == {
        ds2.reader_study.editors_group: {"view_image"},
        ds2.reader_study.readers_group: {"view_image"},
    }