def METHOD_NAME(self, mock_send_email, approved, needs_approval, expected, send_email_counts):
    inactive = {
        'attendee_html_after_08/11': 42,
        'attendee_txt_after_08/11_before_08/12': 42,
        'attendee_html_before_08/09': 42,
        'attendee_txt_after_08/08_before_08/09': 42,
    }
    with Session() as session:
        for automated_email in session.query(AutomatedEmail):
            automated_email.approved = approved
            automated_email.needs_approval = needs_approval
            automated_email.unapproved_count = 42
    for send_email_count in send_email_counts:
        results = send_automated_emails()
        assert results == expected
        assert mock_send_email.call_count == send_email_count
        with Session() as session:
            automated_emails = session.query(AutomatedEmail).all()
            assert len(automated_emails) == 8
            for automated_email in automated_emails:
                ident = automated_email.ident
                assert automated_email.unapproved_count == expected.get(ident, inactive.get(ident, 0))
                if automated_email.unapproved_count == 0:
                    assert len(automated_email.emails) == 5
                    assert sorted(map(lambda e: (e.model, e.fk_id), automated_email.emails)) == [
                        ('Attendee', '00000000-0000-0000-0000-000000000000'),
                        ('Attendee', '00000000-0000-0000-0000-000000000001'),
                        ('Attendee', '00000000-0000-0000-0000-000000000002'),
                        ('Attendee', '00000000-0000-0000-0000-000000000003'),
                        ('Attendee', '00000000-0000-0000-0000-000000000004')]
                else:
                    assert len(automated_email.emails) == 0