Reorganize check_emailable_users

Authored by JeanFred on Sep 3 2019, 4:35 PM.


Reorganize check_emailable_users

Various reorganizations to make the code more testable
and maintainable

  • Rename method get_users into get_usernames_from_database and make it return a list rather than a list of tuples
  • Extract method get_non_emailable_users, which takes as argument a list of usernames and returns a list of User objects
  • Extract method notify_users, which just loops over the given users to call notify_user and do some error handling
  • Bind all three main methods into the process method

Change-Id: I13ba3f0ce877cbc1a766c6b12a3186ab1e2e7c65