def test_total_number(self): b = MEntity.total_number() self.add_message() a = MEntity.total_number() assert b + 1 <= a self.tearDown()
def render(self, *args, **kwargs): current = int(args[0]) pager_count = int(MEntity.total_number() / config.CMS_CFG['list_num']) page_num = (pager_count if abs(pager_count - MEntity.total_number() / config.CMS_CFG['list_num']) < 0.1 else pager_count + 1) kwd = { 'page_home': False if current <= 1 else True, 'page_end': False if current >= page_num else True, 'page_pre': False if current <= 1 else True, 'page_next': False if current >= page_num else True, } return self.render_string('modules/post/entity_pager.html', kwd=kwd, pager_num=page_num, page_current=current)
def test_total_number(self): MEntity.total_number() assert True