示例#1
0
 def test_get_open_threads_without_suggestions(self):
     with self.swap(feedback_models.FeedbackThreadModel, 'get_threads',
                    self._get_threads):
         with self.swap(utils, 'get_time_in_millisecs',
                        self._get_milliseconds):
             threads = feedback_services.get_open_threads(
                 self.EXP_ID1, False)
     self.assertEqual(len(threads), 1)
     self.assertEqual(threads[0]['thread_id'], self.THREAD_ID5)
示例#2
0
    def get(self, exploration_id):
        threads = None
        list_type = self.request.get('list_type')
        has_suggestion = self._string_to_bool(
            self.request.get('has_suggestion'))
        if has_suggestion is None:
            raise self.InvalidInputException(
                'Invalid value for has_suggestion.')
        if list_type == self._LIST_TYPE_OPEN:
            threads = feedback_services.get_open_threads(
                exploration_id, has_suggestion)
        elif list_type == self._LIST_TYPE_CLOSED:
            threads = feedback_services.get_closed_threads(
                exploration_id, has_suggestion)
        elif list_type == self._LIST_TYPE_ALL:
            threads = feedback_services.get_all_threads(
                exploration_id, has_suggestion)
        else:
            raise self.InvalidInputException('Invalid list type.')

        self.values.update({'threads': [t.to_dict() for t in threads]})
        self.render_json(self.values)
示例#3
0
    def get(self, exploration_id):
        threads = None
        list_type = self.request.get('list_type')
        has_suggestion = self._string_to_bool(
            self.request.get('has_suggestion'))
        if has_suggestion is None:
            raise self.InvalidInputException(
                'Invalid value for has_suggestion.')
        if list_type == self._LIST_TYPE_OPEN:
            threads = feedback_services.get_open_threads(
                exploration_id, has_suggestion)
        elif list_type == self._LIST_TYPE_CLOSED:
            threads = feedback_services.get_closed_threads(
                exploration_id, has_suggestion)
        elif list_type == self._LIST_TYPE_ALL:
            threads = feedback_services.get_all_threads(
                exploration_id, has_suggestion)
        else:
            raise self.InvalidInputException('Invalid list type.')

        self.values.update({'threads': [t.to_dict() for t in threads]})
        self.render_json(self.values)
示例#4
0
 def test_get_open_threads_without_suggestions(self):
     threads = feedback_services.get_open_threads(self.EXP_ID1, False)
     self.assertEqual(len(threads), 1)
     self.assertEqual(threads[0].id, self.EXP_ID1 + '.' + self.THREAD_ID5)
示例#5
0
 def test_get_open_threads_without_suggestions(self):
     threads = feedback_services.get_open_threads(self.EXP_ID1, False)
     self.assertEqual(len(threads), 1)
     self.assertEqual(threads[0].id, self.EXP_ID1 + '.' + self.THREAD_ID5)