def test_find_trending_word_with_exception(self): for each_word, each_word_dict in data.EXCEPTION_THROWING_WORDS['trending'].items(): expected_status_code = each_word_dict.get('status_code') tree, status_code = greb.make_parse_tree(data.COMMON['URLS']['base'].format(word=each_word)) self.assertEqual(status_code, expected_status_code) trending_words = greb.find_trending_words(tree) self.assertEqual(trending_words, each_word_dict.get('console_output'))
def test_find_trending_word_with_exception(self): for each_word, each_word_dict in data.EXCEPTION_THROWING_WORDS[ 'trending'].items(): expected_status_code = each_word_dict.get('status_code') tree, status_code = greb.make_parse_tree( data.COMMON['URLS']['base'].format(word=each_word)) self.assertEqual(status_code, expected_status_code) trending_words = greb.find_trending_words(tree) self.assertEqual(trending_words, each_word_dict.get('console_output'))
def test_find_trending_words(self): tree, status_code = greb.make_parse_tree(data.COMMON['URLS']['home']) self.assertEqual(status_code, data.COMMON['STATUS_CODE']['ok']) trending_words = greb.find_trending_words(tree) self.assertEqual(len(trending_words), 5)