Esempio n. 1
0
 def test_index_(self):
     from board.views import index_
     # Make sure that index_() does not add empty posts
     postCount = db.query(Post).count()
     info = index_(testing.DummyRequest(params={'text': u''}, post=True))
     self.assertEqual(len(info['posts']), postCount)
     # Make sure that index_() increments the number of posts
     postCount = db.query(Post).count()
     info = index_(testing.DummyRequest(params={'text': u'four'}, post=True))
     self.assertEqual(len(info['posts']), postCount + 1)
Esempio n. 2
0
 def test_index_(self):
     from board.views import index_
     # Make sure that index_() does not add empty posts
     postCount = db.query(Post).count()
     info = index_(testing.DummyRequest(params={'text': u''}, post=True))
     self.assertEqual(len(info['posts']), postCount)
     # Make sure that index_() increments the number of posts
     postCount = db.query(Post).count()
     info = index_(testing.DummyRequest(params={'text': u'four'},
                                        post=True))
     self.assertEqual(len(info['posts']), postCount + 1)
Esempio n. 3
0
 def test_index(self):
     from board.views import index
     # Make sure that index() returns as many posts as exist in the database
     info = index(testing.DummyRequest())
     self.assertEqual(len(info['posts']), db.query(Post).count())
Esempio n. 4
0
def get_posts():
    return db.query(Post).order_by(Post.id.desc()).all()
Esempio n. 5
0
 def test_index(self):
     from board.views import index
     # Make sure that index() returns as many posts as exist in the database
     info = index(testing.DummyRequest())
     self.assertEqual(len(info['posts']), db.query(Post).count())
Esempio n. 6
0
def get_posts():
    return db.query(Post).order_by(Post.id.desc()).all()