Esempio n. 1
0
    def test_get_polls(self, app):
        with app.app_context():
            now = datetime.now()
            p = Poll(id=None, name="Nom", date=now)
            p.save()

            p = Poll(id=None, name="Nom #2", date=now)
            p.save()

            new_poll = Poll.get_polls()

            assert new_poll[0].id == 1
            assert new_poll[0].name == "Nom"
            assert new_poll[0].date == str(now)

            assert new_poll[1].id == 2
            assert new_poll[1].name == "Nom #2"
            assert new_poll[1].date == str(now)
Esempio n. 2
0
 def index():
     polls = Poll.get_polls(request.args.get('query'))
     if polls:
         return views.index(polls)
     else:
         return views.index_empty()
Esempio n. 3
0
 def index():
     polls = Poll.get_polls()
     if polls:
         return views.index(polls)
     else:
         return views.index_empty()