Some user unit tests, and fixes/clarifications.

Should probably pull the mail code out of add_user, that function is
getting a bit long. Would help with unit testing too.