예제 #1
0
    def test_get_hot_post(self):
        user = backend.add_user('user02','*****@*****.**','pass02')
        post1 = backend.add_post('title01',user['id'],content='content01')
        post2 = backend.add_post('title02',user['id'],content='content02')
        post2 = backend.add_post('title03',user['id'],content='content03')

        posts = backend.get_hot_post()
        assert len(posts) == 3

        count = backend.get_post_count()
        assert count == 3
예제 #2
0
    def test_get_hot_post(self):
        user = backend.add_user('user02', '*****@*****.**', 'pass02')
        post1 = backend.add_post('title01', user['id'], content='content01')
        post2 = backend.add_post('title02', user['id'], content='content02')
        post2 = backend.add_post('title03', user['id'], content='content03')

        posts = backend.get_hot_post()
        assert len(posts) == 3

        count = backend.get_post_count()
        assert count == 3
예제 #3
0
파일: index.py 프로젝트: timgates42/missing
def index():
    try:
        page = int(request.values.get('page',1))
    except:
        page = 1

    if page <= 0:page = 1
    
    offset = (page-1) * 50
    latest_posts = backend.get_latest_post(offset=offset,limit=50)
    post_count = backend.get_post_count()

    hot_posts = backend.get_hot_post(offset=offset,limit=50)
    
    return render_template(latest_posts=latest_posts,hot_posts=hot_posts,
                                post_count=post_count,page=page)