def test_sent(): ps = PendingSend('abc') ps.toaddr = '*****@*****.**' assert ps.sent_time is None then = datetime.now() - timedelta(seconds=2) ps.mark_sent() sent_time = ps.sent_time assert sent_time > then assert ps.is_sent
def test_sent(): ps = PendingSend('abc') ps.toaddr = '*****@*****.**' assert ps.sent_time is None then = datetime.now() - timedelta(seconds = 2) ps.mark_sent() sent_time = ps.sent_time assert sent_time > then assert ps.is_sent
def test_unsent_and_sent(): ps = PendingSend() ps.toaddr = '*****@*****.**' ps.template_name = 'template-1' ps.template_vars = {"foo": 'bar'} ps.mark_sent() ps.save() ps = PendingSend() ps.toaddr = '*****@*****.**' ps.template_name = 'template-1' ps.template_vars = {"foo": 'bar'} ps.save() unsent = list(PendingSend.Unsent()) assert len(unsent) == 1 ps = unsent[0] toaddr = ps.toaddr assert toaddr == '*****@*****.**'