def test_render_template(tenant, status, do_email_send): tenant.expires = '2014-01-01' update_expiry.send_email(tenant, status) assert do_email_send.called args = do_email_send.call_args[0] subject, body, to = args assert to == tenant.owner.email assert tenant.name in subject assert tenant.name in body if status == 'second': assert tenant.expires in body
def test_disabled_user_doesnt_get_emailed(tenant, do_email_send): tenant.owner.enabled = False update_expiry.send_email(tenant, 'first') assert not do_email_send.called