Example #1
0
    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.
Example #2
0
    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']))
Example #3
0
    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']))
Example #4
0
 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.
Example #6
0
 def hero(self):
     return Hero.get_by_id(self.hero_id)
Example #7
0
def update_hero_data():
    from app.dota.models import Hero
    Hero.update_data()