def test_delete_planet_not_found(self): planet_id = 'xxxxxxxxxxxx' table = self.create_table() db = DBConnection() response = db.delete_planet(planet_id) assert bool(response) == False
def delete(self, planet_id): try: db = DBConnection() result = db.delete_planet(planet_id) if not result: self.set_status(404) self.finish("Planet not found") return self.write( {'message': 'Planet with id={} was deleted'.format(planet_id)}) except Exception as e: logger.exception("DeletePlanet::delete") raise Exception('Error to delete planet')
def test_delete_planet(self): planet_id = 'yyyyyyyyyyy' planet = { "planet_id": planet_id, "planet_name": "Marcela", "terrain": "Arenoso", "climate": "Deserto" } table = self.create_table() table.put_item(Item=planet) db = DBConnection() response = db.delete_planet(planet_id) assert bool(response) == True