def test_get_perspectives(self): url = 'http://jpost.com/Israel-News/ICC-rejects-pro-Turkey-war-crimes-allegations-against-IDF-in-Gaza-flotilla-raid-380955' res = perspectives.get_perspectives(url) compared_articles = json.loads(res) length = len(compared_articles) self.assertTrue(length > 5, 'Length is %s' % length) self.assertTrue(compared_articles[0]['sentences'], 'Result not of expected format')
def test_get_perspectives_non_article(self): url = 'http://facebook.com/' res = json.loads(perspectives.get_perspectives(url)) self.assertEqual(res, {'Error': 'Not a recognized article'})
def test_get_perspectives(self): url = 'http://jpost.com/Israel-News/ICC-rejects-pro-Turkey-war-crimes-allegations-against-IDF-in-Gaza-flotilla-raid-380955' res = perspectives.get_perspectives(url) compared_articles = json.loads(res) self.assertTrue(len(compared_articles) > 10) self.assertTrue(compared_articles[0]['sentences'])