def test_disqus_list_popular(self): results = get_disqus_results(PATHNAME + 'listPopular.json') self.assertEqual(len(results), 10) self.assertEqual(results[0]['title'], 'Popular 0') self.assertEqual(results[1]['title'], 'Popular 1') self.assertEqual(results[2]['title'], 'Popular 2') self.assertEqual(results[3]['title'], 'Popular 3') self.assertEqual(results[4]['title'], 'Popular 4') self.assertEqual(results[5]['title'], 'Popular 5') self.assertEqual(results[6]['title'], 'Popular 6') self.assertEqual(results[7]['title'], 'Popular 7') self.assertEqual(results[8]['title'], 'Popular 8') self.assertEqual(results[9]['title'], 'Popular 9') # si hay algún error se retorna una lista vacía self.assertEqual(get_disqus_results('listPopular.error.json'), [])
def test_disqus_list_hot(self): results = get_disqus_results(PATHNAME + 'listHot.json') self.assertEqual(len(results), 10) self.assertEqual(results[0]['title'], 'Hot 0') self.assertEqual(results[1]['title'], 'Hot 1') self.assertEqual(results[2]['title'], 'Hot 2') self.assertEqual(results[3]['title'], 'Hot 3') self.assertEqual(results[4]['title'], 'Hot 4') self.assertEqual(results[5]['title'], 'Hot 5') self.assertEqual(results[6]['title'], 'Hot 6') self.assertEqual(results[7]['title'], 'Hot 7') self.assertEqual(results[8]['title'], 'Hot 8') self.assertEqual(results[9]['title'], 'Hot 9') # si hay algún error se retorna una lista vacía self.assertEqual(get_disqus_results('listHot.error.json'), [])
def test_disqus_wrong_response(self): results = get_disqus_results(PATHNAME + 'response.notjson') self.assertEqual(results, [])