def _get_suggestion_from_model(suggestion_model): """Converts the given SuggestionModel to a Suggestion object. Args: suggestion_model: SuggestionModel. Returns: Suggestion. The corresponding Suggestion domain object. """ return feedback_domain.Suggestion( suggestion_model.id, suggestion_model.author_id, suggestion_model.exploration_id, suggestion_model.exploration_version, suggestion_model.state_name, suggestion_model.description, suggestion_model.get_suggestion_html())
def test_to_dict(self): expected_suggestion_dict = { 'author_name': self.OWNER_USERNAME, 'exploration_id': self.EXP_ID, 'exploration_version': 1, 'state_name': 'a state name', 'description': 'a description', 'suggestion_html': 'suggestion HTML', } observed_suggestion = feedback_domain.Suggestion( self.THREAD_ID, self.owner_id, self.EXP_ID, expected_suggestion_dict['exploration_version'], expected_suggestion_dict['state_name'], expected_suggestion_dict['description'], expected_suggestion_dict['suggestion_html']) self.assertDictEqual(expected_suggestion_dict, observed_suggestion.to_dict())
def _get_suggestion_from_model(suggestion_model): return feedback_domain.Suggestion( suggestion_model.id, suggestion_model.author_id, suggestion_model.exploration_id, suggestion_model.exploration_version, suggestion_model.state_name, suggestion_model.description, suggestion_model.state_content)