def test_regenerate_opportunities_related_to_topic_when_story_deleted( self): story_models.StoryModel.delete_by_id(self.STORY_ID) self.assertRaisesRegexp( Exception, 'Failed to regenerate opportunities', lambda: (opportunity_services.regenerate_opportunities_related_to_topic( self.TOPIC_ID)))
def map(topic_model): if topic_model.deleted: return try: result = ( opportunity_services.regenerate_opportunities_related_to_topic( topic_model.id)) yield ('SUCCESS', result) except Exception as e: yield ('FAILED', e)