def test_nonexistent_thread(self):
     thread_id = "nonexistent_thread"
     self.register_get_thread_error_response(thread_id, 404)
     with self.assertRaises(Http404):
         get_comment_list(self.request,
                          thread_id,
                          endorsed=False,
                          page=1,
                          page_size=1)
Beispiel #2
0
 def get_comment_list(self, thread, endorsed=None, page=1, page_size=1):
     """
     Register the appropriate comments service response, then call
     get_comment_list and return the result.
     """
     self.register_get_thread_response(thread)
     return get_comment_list(self.request, thread["id"], endorsed, page, page_size)
Beispiel #3
0
 def list(self, request):
     """
     Implements the GET method for the list endpoint as described in the
     class docstring.
     """
     form = CommentListGetForm(request.GET)
     if not form.is_valid():
         raise ValidationError(form.errors)
     return get_comment_list(request, form.cleaned_data["thread_id"],
                             form.cleaned_data["endorsed"],
                             form.cleaned_data["page"],
                             form.cleaned_data["page_size"])
Beispiel #4
0
 def list(self, request):
     """
     Implements the GET method for the list endpoint as described in the
     class docstring.
     """
     form = CommentListGetForm(request.GET)
     if not form.is_valid():
         raise ValidationError(form.errors)
     return get_comment_list(
         request,
         form.cleaned_data["thread_id"],
         form.cleaned_data["endorsed"],
         form.cleaned_data["page"],
         form.cleaned_data["page_size"],
     )
Beispiel #5
0
 def test_nonexistent_thread(self):
     thread_id = "nonexistent_thread"
     self.register_get_thread_error_response(thread_id, 404)
     with self.assertRaises(Http404):
         get_comment_list(self.request, thread_id, endorsed=False, page=1, page_size=1)