Ejemplo n.º 1
0
def test_simple_properties():
    ps = PendingSend('abc')
    ps.toaddr = '*****@*****.**'
    ps.template_name = 'template-1'
    ps.last_error = 'bacon'

    assert ps.toaddr == '*****@*****.**'
    assert ps.template_name == 'template-1'
    assert ps.last_error == 'bacon'
Ejemplo n.º 2
0
def test_simple_properties():
    ps = PendingSend('abc')
    ps.toaddr = '*****@*****.**'
    ps.template_name = 'template-1'
    ps.last_error = 'bacon'

    assert ps.toaddr == '*****@*****.**'
    assert ps.template_name == 'template-1'
    assert ps.last_error == 'bacon'
Ejemplo n.º 3
0
def test_creation():
    ps = PendingSend()
    ps.toaddr = '*****@*****.**'
    ps.template_name = 'template-1'
    ps.template_vars = {"foo": 'bar'}
    ps.last_error = 'bacon'

    assert ps.id is None
    ps.save()
    assert ps.in_db
    assert ps.id > 0

    ps = PendingSend(ps.id)
    assert ps.in_db
    assert ps.toaddr == '*****@*****.**'
    assert ps.template_name == 'template-1'
    assert ps.template_vars == {'foo': 'bar'}
    assert ps.last_error == 'bacon'
    assert ps.retry_count == 0
    assert ps.age > timedelta()
    assert ps.age < timedelta(minutes=1)
Ejemplo n.º 4
0
def test_creation():
    ps = PendingSend()
    ps.toaddr = '*****@*****.**'
    ps.template_name = 'template-1'
    ps.template_vars = {"foo": 'bar'}
    ps.last_error = 'bacon'

    assert ps.id is None
    ps.save()
    assert ps.in_db
    assert ps.id > 0

    ps = PendingSend(ps.id)
    assert ps.in_db
    assert ps.toaddr == '*****@*****.**'
    assert ps.template_name == 'template-1'
    assert ps.template_vars == {'foo': 'bar'}
    assert ps.last_error == 'bacon'
    assert ps.retry_count == 0
    assert ps.age > timedelta()
    assert ps.age < timedelta(minutes = 1)