コード例 #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)
コード例 #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)
コード例 #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())
コード例 #4
0
def get_posts():
    return db.query(Post).order_by(Post.id.desc()).all()
コード例 #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())
コード例 #6
0
def get_posts():
    return db.query(Post).order_by(Post.id.desc()).all()