예제 #1
0
    def test_index(self, app, client):
        with app.app_context():
            now = datetime.now()
            p = Poll(id=None, name="Mon premier sondage", date=now)
            p.save()

            response = client.get("/")
            assert Poll.select().count() == 1
            assert response.status_code == 200
            assert b"Aucuns sondages actifs" not in response.data
            assert b"Mon premier sondage" in response.data
예제 #2
0
파일: __init__.py 프로젝트: xuorig/INF5190
 def index():
     polls = Poll.select()
     if polls:
         return views.index(polls)
     else:
         return views.index_empty()
예제 #3
0
 def test_empty_index(self, app, client):
     with app.app_context():
         response = client.get("/")
         assert response.status_code == 200
         assert Poll.select().count() == 0
         assert b"Aucuns sondages actifs" in response.data