예제 #1
0
 def test_reject_suggestion_that_has_already_been_handled(self):
     exception_message = 'Suggestion has already been accepted/rejected'
     with self.swap(constants, 'ENABLE_GENERALIZED_FEEDBACK_THREADS',
                    False):
         with self.swap(exp_services, '_is_suggestion_handled',
                        self._return_true):
             with self.assertRaisesRegexp(Exception, exception_message):
                 exp_services.reject_suggestion(self.editor_id,
                                                self.THREAD_ID2)
예제 #2
0
    def put(self, exploration_id, thread_id):
        action = self.payload.get('action')
        if action == self._ACCEPT_ACTION:
            exp_services.accept_suggestion(
                self.user_id, thread_id, exploration_id,
                self.payload.get('commit_message'),
                self.payload.get('audio_update_required'))
        elif action == self._REJECT_ACTION:
            exp_services.reject_suggestion(self.user_id, thread_id)
        else:
            raise self.InvalidInputException('Invalid action.')

        self.render_json(self.values)
예제 #3
0
파일: feedback.py 프로젝트: alexgower/oppia
    def put(self, exploration_id, thread_id):
        action = self.payload.get('action')
        if action == self._ACCEPT_ACTION:
            exp_services.accept_suggestion(
                self.user_id,
                thread_id,
                exploration_id,
                self.payload.get('commit_message'))
        elif action == self._REJECT_ACTION:
            exp_services.reject_suggestion(
                self.user_id, thread_id, exploration_id)
        else:
            raise self.InvalidInputException('Invalid action.')

        self.render_json(self.values)
예제 #4
0
 def test_reject_suggestion(self):
     with self.swap(constants, 'ENABLE_GENERALIZED_FEEDBACK_THREADS',
                    False):
         exp_services.reject_suggestion(self.editor_id, self.THREAD_ID2)
         thread = feedback_models.FeedbackThreadModel.get(self.THREAD_ID2)
     self.assertEqual(thread.status, feedback_models.STATUS_CHOICES_IGNORED)