示例#1
0
 def test_store_questions(self):
     dbquestion.store_printed_question(question_id = 1, service = 'fooservice', title = 'footitle', tags = ['tag1', 'tag2'],deleted = False)
     questions_list = dbquestion.get_top_printed_questions(1)
     self.assertEquals(len(questions_list), 1)
     self.assertEquals(questions_list[0].question_id, 1)
     dbquestion.store_printed_question(question_id = 1, service = 'fooservice', title = 'footitle', tags = ['tag1', 'tag2'],deleted = False)
     self.assertEquals(len(questions_list), 1)
     self.assertEquals(questions_list[0].question_id, 1)
     dbquestion.store_printed_question(question_id = 2, service = 'fooservice', title = 'footitle2', tags = ['tag1', 'tag2'],deleted = False)
     questions_list = dbquestion.get_top_printed_questions(1)
     self.assertEquals(len(questions_list), 2)
     self.assertEquals(questions_list[0].question_id, 1)
     self.assertEquals(questions_list[1].question_id, 2)
     dbquestion.store_printed_question(question_id = 2, service = 'fooservice', title = 'footitle2', tags = ['tag1', 'tag2'],deleted = False)
     dbquestion.store_printed_question(question_id = 2, service = 'fooservice', title = 'footitle2', tags = ['tag1', 'tag2'],deleted = False)
     questions_list = dbquestion.get_top_printed_questions(1)
     self.assertEquals(len(questions_list), 2)
     self.assertEquals(questions_list[0].question_id, 2)
     self.assertEquals(questions_list[1].question_id, 1)
     self.assertEquals(questions_list[1].tags, ['tag1', 'tag2'])
     dbquestion.store_printed_question(question_id = 3, service = 'fooservice', title = 'footitle2', tags = ['tag1', 'tag2'],deleted = True)
     questions_list = dbquestion.get_top_printed_questions(1)
     self.assertEquals(len(questions_list), 3)
     questions_list = dbquestion.get_deleted_questions()
     self.assertEquals(len(questions_list), 1)
示例#2
0
 def GET(self):
     try:
         result = []
         page = web.input(page = 1)['page']
         result = dbquestion.get_top_printed_questions(page)
         count = dbquestion.get_top_printed_count()
         return render.topprinted(result, int(page), dbquestion.TOP_PRINTED_PAGINATION_SIZE, count)  
     except Exception, exception:
         logging.exception("Generic exception")
         return render.oops(GENERIC_ERROR)
示例#3
0
 def GET(self):
     try:
         result = []
         page = web.input(page = 1)['page']
         result = dbquestion.get_top_printed_questions(page)
         count = dbquestion.get_top_printed_count()
         return render.topprinted(result, int(page), dbquestion.TOP_PRINTED_PAGINATION_SIZE, count)  
     except Exception, exception:
         logging.exception("Generic exception")
         return render.oops(GENERIC_ERROR)