Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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 == '*****@*****.**'
Ejemplo n.º 4
0
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 == '*****@*****.**'