Finish writing tests for alertlib.

Summary:
I didn't spend the time to make the tests shorter, so they're pretty
verbose, especially the email tests.  (I tested both gae and sendmail
for every test, which was probably overkill.)

This turned up a few bugs, a crashing bug in how I was calling
sendmail ('to' is a string of comma-separated names, not a list), and
a usability bug in that we allowed email messages that don't end in
newline.

Test Plan: tests/alertlib_test.py

Auditors: chris

Differential Revision: http://phabricator.khanacademy.org/D8680