Commit b7e9bed1 by Oleg Marshev

Add test.

parent 4627cf17
...@@ -469,6 +469,14 @@ class AnnotationViewTests(BaseAnnotationViewTests): ...@@ -469,6 +469,14 @@ class AnnotationViewTests(BaseAnnotationViewTests):
self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(response.data), 5, "five annotations should be returned in response") self.assertEqual(len(response.data), 5, "five annotations should be returned in response")
def test_read_all_no_query_param(self):
"""
Tests list all annotations when course_id query param is not present.
"""
url = reverse('api:v1:annotations')
response = self.client.get(url, self.headers)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
@patch('django.conf.settings.DISABLE_TOKEN_CHECK', True) @patch('django.conf.settings.DISABLE_TOKEN_CHECK', True)
class AllowAllAnnotationViewTests(BaseAnnotationViewTests): class AllowAllAnnotationViewTests(BaseAnnotationViewTests):
......
...@@ -58,7 +58,7 @@ class AnnotationListView(APIView): ...@@ -58,7 +58,7 @@ class AnnotationListView(APIView):
""" """
params = self.request.QUERY_PARAMS.dict() params = self.request.QUERY_PARAMS.dict()
if 'course_id' and 'user' not in params: if 'course_id' not in params:
return Response(status=status.HTTP_400_BAD_REQUEST) return Response(status=status.HTTP_400_BAD_REQUEST)
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment