def METHOD_NAME(self):
    """
    Test that we retry when an exception occurs while checking old
    entitlements.
    """
    make_entitlement()
    with mock.patch(
        'common.djangoapps.entitlements.models.CourseEntitlement.expired_at_datetime',
        new_callable=mock.PropertyMock,
        side_effect=boom
    ) as mock_datetime:
        task = tasks.expire_old_entitlements.delay(1, 2)
    pytest.raises(Exception, task.get)
    assert mock_datetime.call_count == (tasks.MAX_RETRIES + 1)