示例#1
0
    def test_delete_hero(self):
        """Test delete hero"""
        # Criando o heroi
        hero = self.create_hero('Joker', 'dc')
        # excluindo o heroi
        Hero.delete(hero.id)

        # consultando se o heroi foi mesmo excluido
        self.assertIsNone(Hero.get_hero(hero.id))
示例#2
0
    def delete(self, hero_id):
        """Delete hero"""
        try:
            Hero.delete(hero_id)
            return {'message': 'Hero deleted'}

        except Exception as error:
            return {
                       'message': 'Error on delete hero',
                       'details': str(error)
                   }, 500
示例#3
0
    def delete(self, hero_id):
        """Delete hero"""
        try:
            hero = Hero.delete(hero_id)
            if not hero:
                return {'message': 'Hero deleted'}, 200
            return {'message': 'Hero not found'}, 404

        except Exception as error:
            return {
                'message': 'Error on delete hero',
                'details': str(error)
            }, 500