예제 #1
0
class BoardTest(unittest.TestCase):
    '''
    Тестирование класса для парсинга топиков и комментариев к ним
    '''
    
    def setUp(self):
        self.board = Board(GID)

    def test_get(self):
        topics = self.board.get_topics()


        topics_count = len(topics)

        self.assertTrue(topics_count > 0)
        self.assertTrue(len(filter(lambda x: x['count'] > 0, topics)) == topics_count)     
        
    def test_getComments(self):
        comments = self.board.get_comments(TOPIC_ID)
        self.assertTrue(len(comments) > 0)   
        self.assertTrue(len(filter(lambda x: x.date is not None, comments)) > 0)
        
    def test_count(self):
        count = self.board.get_count()
        self.assertNotEqual(count, None)
        self.assertGreater(count, 0)