def test_get_all(self): """ Test we get a populated list of heroes """ heroes = Hero.get_all() self.assertIsInstance(heroes, list) self.assertGreaterEqual( len(heroes), 107 ) # 107 at time of test writing. This will fail if the WebAPI is down.
def test_get_by_name(self): """ Test we can get a hero by their name """ crystal_maiden = Hero.get_by_name(self.CRYSTAL_MAIDEN['name']) self.assertIsNotNone(crystal_maiden) self.assertEqual(crystal_maiden.id, self.CRYSTAL_MAIDEN['id']) self.assertEqual(crystal_maiden.name, self.CRYSTAL_MAIDEN['name']) self.assertEqual(crystal_maiden.localized_name, self.CRYSTAL_MAIDEN['localized_name']) self.assertEqual(crystal_maiden.image, url_for('hero_image', hero_name=self.CRYSTAL_MAIDEN['image_name']))
def test_get_by_name(self): """ Test we can get a hero by their token """ crystal_maiden = Hero.get_by_name(self.CRYSTAL_MAIDEN['name']) self.assertIsNotNone(crystal_maiden) self.assertEqual(crystal_maiden.id, self.CRYSTAL_MAIDEN['id']) self.assertEqual(crystal_maiden.token, self.CRYSTAL_MAIDEN['token']) self.assertEqual(crystal_maiden.name, self.CRYSTAL_MAIDEN['name']) self.assertEqual(crystal_maiden.localized_name, self.CRYSTAL_MAIDEN['localized_name']) self.assertEqual( crystal_maiden.image, url_for('hero_image', hero_name=self.CRYSTAL_MAIDEN['image_name']))
def hero(self): return Hero.get_by_id(self.hero_id)
def test_get_all(self): """ Test we get a populated list of heroes """ heroes = Hero.get_all() self.assertIsInstance(heroes, list) self.assertGreaterEqual(len(heroes), 107) # 107 at time of test writing. This will fail if the WebAPI is down.
def update_hero_data(): from app.dota.models import Hero Hero.update_data()