Esempio n. 1
0
def test_base():
    data = {'some': u'data'}
    c = Confirm(u'__test_store', data, 1)
    eq_(c.expires, date.today() + timedelta(days=1))
    db.session.commit()
    call_confirm(c.key)

    def _second_run():
        call_confirm(c.key)
    assert_raises(KeyError, _second_run)

    c = Confirm(u'__test_store2', data, 1)
    db.session.commit()
    call_confirm(c.key)

    eq_(CONFIRM_LOG, [data, (2, data)])
Esempio n. 2
0
def test_base():
    data = {'some': u'data'}
    c = Confirm(u'__test_store', data, 1)
    eq_(c.expires, date.today() + timedelta(days=1))
    db.session.commit()
    call_confirm(c.key)

    def _second_run():
        call_confirm(c.key)

    assert_raises(KeyError, _second_run)

    c = Confirm(u'__test_store2', data, 1)
    db.session.commit()
    call_confirm(c.key)

    eq_(CONFIRM_LOG, [data, (2, data)])
Esempio n. 3
0
    def confirm(self, request, key):
        try:
            ret = call_confirm(key)
        except KeyError:
            ret = _(u'Key not found. Maybe it has already been used?'), False
        except Expired:
            ret = _(u'The supplied key is not valid anymore.'), False

        if isinstance(ret, tuple) and len(ret) == 2:
            return Response(u'%s: %s' % (['success', 'fail'][not ret[1]],
                                        ret[0]), mimetype='text/plain')
        return ret
Esempio n. 4
0
 def _second_run():
     call_confirm(c.key)
Esempio n. 5
0
 def _second_run():
     call_confirm(c.key)