def test_accept_suggestion_with_images(self):
    html_content = '<p>Value</p><oppia-noninteractive-math math_content-with-value="{&amp;quot;raw_latex&amp;quot;: &amp;quot;+,-,-,+&amp;quot;, &amp;quot;svg_filename&amp;quot;: &amp;quot;img.svg&amp;quot;}"></oppia-noninteractive-math>'
    question_state_dict = self._create_valid_question_data('default_state').to_dict()
    question_state_dict['content']['html'] = html_content
    with python_utils.open_file(os.path.join(feconf.TESTS_DATA_DIR, 'test_svg.svg'), 'rb', encoding=None) as f:
        raw_image = f.read()
    image_context = feconf.IMAGE_CONTEXT_QUESTION_SUGGESTIONS
    fs_services.save_original_and_compressed_versions_of_image('img.svg', image_context, 'skill1', raw_image, 'image', False)
    self.save_new_skill('skill1', self.author_id, description='description')
    suggestion_dict = {'suggestion_id': 'skill1.thread1', 'suggestion_type': feconf.SUGGESTION_TYPE_ADD_QUESTION, 'target_type': feconf.ENTITY_TYPE_SKILL, 'target_id': 'skill1', 'target_version_at_submission': 1, 'status': suggestion_models.STATUS_ACCEPTED, 'author_name': 'author', 'final_reviewer_id': self.reviewer_id, 'change': {'cmd': question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION, 'question_dict': {'question_state_data': question_state_dict, 'language_code': 'en', 'question_state_data_schema_version': feconf.CURRENT_STATE_SCHEMA_VERSION, 'linked_skill_ids': ['skill_1'], 'inapplicable_skill_misconception_ids': []}, 'skill_id': 'skill1', 'skill_difficulty': 0.3}, 'score_category': 'question.skill1', 'language_code': 'en', 'last_updated': utils.get_time_in_millisecs(self.fake_date)}
    suggestion = suggestion_registry.SuggestionAddQuestion(suggestion_dict['suggestion_id'], suggestion_dict['target_id'], suggestion_dict['target_version_at_submission'], suggestion_dict['status'], self.author_id, self.reviewer_id, suggestion_dict['change'], suggestion_dict['score_category'], suggestion_dict['language_code'], False, self.fake_date)
    suggestion.accept('commit_message')
def test_accept_suggestion_with_images(self):
    html_content = '<p>Value</p><oppia-noninteractive-math math_content-with-value="{&amp;quot;raw_latex&amp;quot;: &amp;quot;+,-,-,+&amp;quot;, &amp;quot;svg_filename&amp;quot;: &amp;quot;img.svg&amp;quot;}"></oppia-noninteractive-math>'
    question_state_dict = self._create_valid_question_data('default_state').to_dict()
    question_state_dict['content']['html'] = html_content
    with python_utils.open_file(os.path.join(feconf.TESTS_DATA_DIR, 'test_svg.svg'), 'rb', encoding=None) as f:
        raw_image = f.read()
    image_context = feconf.IMAGE_CONTEXT_QUESTION_SUGGESTIONS
    fs_services.save_original_and_compressed_versions_of_image('img.svg', image_context, 'skill1', raw_image, 'image', False)
    self.save_new_skill('skill1', self.author_id, description='description')
    suggestion_dict = {'suggestion_id': 'skill1.thread1', 'suggestion_type': feconf.SUGGESTION_TYPE_ADD_QUESTION, 'target_type': feconf.ENTITY_TYPE_SKILL, 'target_id': 'skill1', 'target_version_at_submission': 1, 'status': suggestion_models.STATUS_ACCEPTED, 'author_name': 'author', 'final_reviewer_id': self.reviewer_id, 'change': {'cmd': question_domain.CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION, 'question_dict': {'question_state_data': question_state_dict, 'language_code': 'en', 'question_state_data_schema_version': feconf.CURRENT_STATE_SCHEMA_VERSION, 'linked_skill_ids': ['skill_1'], 'inapplicable_skill_misconception_ids': []}, 'skill_id': 'skill1', 'skill_difficulty': 0.3}, 'score_category': 'question.skill1', 'language_code': 'en', 'last_updated': utils.get_time_in_millisecs(self.fake_date)}
    suggestion = suggestion_registry.SuggestionAddQuestion(suggestion_dict['suggestion_id'], suggestion_dict['target_id'], suggestion_dict['target_version_at_submission'], suggestion_dict['status'], self.author_id, self.reviewer_id, suggestion_dict['change'], suggestion_dict['score_category'], suggestion_dict['language_code'], False, self.fake_date)
    suggestion.accept('commit_message')