def test_email_log_entry(self): settings.email.is_live = False lh = logging_handler('blazeweb.mail') send_mail('test text email', 'email content', ['*****@*****.**']) assert 'Email sent: "test text email" to "*****@*****.**"' \ in lh.messages['info'][0], lh.messages['info'] lh.reset()
def test_mail_admins_wawrning(self): lh = logging_handler('blazeweb.mail') settings.emails.admins = [] _mail_admins('admins email subject', 'email body') assert 'mail_admins() used but settings.emails.admins is empty' in lh.messages['warning'][0] lh.reset()
def test_mail_programmers_wawrning(self): lh = logging_handler('blazeweb.mail') settings.emails.programmers = [] _mail_programmers('programmers email subject', 'email body') assert 'mail_programmers() used but settings.emails.programmers is empty' in \ lh.messages['warning'][0] lh.reset()
def test_findfile_cache(self): eh = logging_handler('blazeweb.hierarchy') findfile('templates/forcache.txt') dmesgs = ''.join(eh.messages['debug']) assert 'in cache' not in dmesgs, dmesgs eh.reset() findfile('templates/forcache.txt') dmesgs = ''.join(eh.messages['debug']) assert 'in cache' in dmesgs, dmesgs eh.reset()
def test_email_log_entry_multiple_senders(self): settings.email.is_live = False lh = logging_handler('blazeweb.mail') to = ['*****@*****.**' % n for n in range(0, 12)] send_mail('test text email', 'email content', to) assert 'Email sent: "test text email" to "[email protected];[email protected];' \ '[email protected];[email protected];[email protected];[email protected];' \ '[email protected];[email protected];[email protected];[email protected];' \ '[email protected];t"' in lh.messages['info'][0], lh.messages['info'] lh.reset()
def test_import_cache(self): eh = logging_handler('blazeweb.hierarchy') view1 = findview('news:OnlyForCache') dmesgs = ''.join(eh.messages['debug']) assert 'in cache' not in dmesgs, dmesgs eh.reset() view2 = findview('news:OnlyForCache') dmesgs = ''.join(eh.messages['debug']) assert 'in cache' in dmesgs, dmesgs assert view1 is view2, (view1, view2)
def test_view_redirect(): eh = logging_handler('blazeweb.application') r = ta.get('/news?sendby=redirect') assert '/applevelview/foo' in r assert r.status_int == 302 dmesgs = ''.join(eh.messages['debug']) assert 'handling http exception' not in dmesgs, dmesgs r = r.follow() assert 'alv: foo, None' in r, r r = ta.get('/news?sendby=rdp') assert r.status_int == 301 r = ta.get('/news?sendby=303') assert r.status_int == 303 eh.reset()
def test_not_live(self, mm_tracker=None): settings.email.is_live = False lh = logging_handler('blazeweb.mail') send_mail('test text email', 'email content', ['*****@*****.**']) assert 'email.is_live = False' in lh.messages['warning'][0] lh.reset()