def METHOD_NAME(
    self,
    event_count: int,
    performance_issues: bool = False,
    generic_issues: bool = False,
):
    with patch.object(sentry, "digests") as digests:
        backend = RedisBackend()
        digests.digest = backend.digest
        for i in range(event_count):
            self.add_event(f"group-{i}", backend, "error")
        if performance_issues:
            self.add_event(f"group-{event_count+1}", backend, "performance")
        if generic_issues:
            self.add_event(f"group-{event_count+2}", backend, "generic")
        with self.tasks():
            deliver_digest(self.key)
        assert len(mail.outbox) == USER_COUNT