Commit 2b07655b by Dave St.Germain

Allow bulk creation.

parent a3c54afe
......@@ -537,6 +537,17 @@ class VideoListTest(APIAuthTestCase):
self.assertEqual(response[0]['edx_video_id'], video['edx_video_id'])
def test_bulk_create(self):
url = reverse('video-list')
response = self.client.post(
url, [constants.COMPLETE_SET_FISH, constants.COMPLETE_SET_DIFFERENT_ID_UPDATE_FISH], format='json'
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
video = self.client.get("/edxval/videos/").data
self.assertEqual(len(video), 2)
self.assertEqual(len(video[0].get("encoded_videos")), 2)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
# Tests for POST queries to database
def test_queries_for_only_video(self):
......
......@@ -2,6 +2,7 @@
Views file for django app edxval.
"""
from rest_framework import generics
from rest_framework_bulk import ListBulkCreateUpdateDestroyAPIView
from rest_framework.authentication import OAuth2Authentication, SessionAuthentication
from rest_framework.permissions import DjangoModelPermissions
from django.http import HttpResponse
......@@ -48,7 +49,7 @@ class MultipleFieldLookupMixin(object):
return get_object_or_404(queryset, **filter) # Lookup the object
class VideoList(generics.ListCreateAPIView):
class VideoList(ListBulkCreateUpdateDestroyAPIView):
"""
GETs or POST video objects
"""
......
django>=1.4,<1.5
djangorestframework<2.4
djangorestframework-bulk
South==0.7.6
-e git+https://github.com/edx/django-oauth2-provider.git@0.2.7-fork-edx-1#egg=django-oauth2-provider
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