Commit f338a709 by Greg Price

Merge pull request #42 from edx/gprice/remove-profile-fields

Remove Profile fields other than name
parents 64aa7637 657c51ed
......@@ -7,7 +7,7 @@ from .models import Video, Profile, EncodedVideo, Subtitle, CourseVideo
class ProfileAdmin(admin.ModelAdmin): # pylint: disable=C0111
list_display = ('id', 'profile_name', 'extension', 'width', 'height')
list_display = ('id', 'profile_name')
list_display_links = ('id', 'profile_name')
admin_order_field = 'profile_name'
......
......@@ -3,11 +3,14 @@
"""
The internal API for VAL. This is not yet stable
"""
from enum import Enum
import logging
from edxval.models import Video, EncodedVideo, CourseVideo
from edxval.serializers import VideoSerializer, ProfileSerializer
from enum import Enum
from django.core.exceptions import ValidationError
from edxval.models import Video, EncodedVideo, CourseVideo, Profile
from edxval.serializers import VideoSerializer
logger = logging.getLogger(__name__) # pylint: disable=C0103
......@@ -88,11 +91,7 @@ def create_video(video_data):
encoded_video: a list of EncodedVideo dicts
url: url of the video
file_size: size of the video in bytes
profile: a dict of encoding details
profile_name: ID of the profile
extension: 3 letter extension of video
width: horizontal pixel resolution
height: vertical pixel resolution
profile: ID of the profile
courses: Courses associated with this video
}
"""
......@@ -104,33 +103,24 @@ def create_video(video_data):
raise ValCannotCreateError(serializer.errors)
def create_profile(profile_data):
def create_profile(profile_name):
"""
Used to create Profile objects in the database
A profile needs to exists before an EncodedVideo object can be created.
Args:
data (dict):
{
profile_name: ID of the profile
extension: 3 letter extension of video
width: horizontal pixel resolution
height: vertical pixel resolution
}
Returns:
(int): id of the newly created object
profile_name (str): ID of the profile
Raises:
ValCannotCreateError: Raised if the serializer throws an error
ValCannotCreateError: Raised if the profile name is invalid or exists
"""
serializer = ProfileSerializer(data=profile_data)
if serializer.is_valid():
serializer.save()
return profile_data.get("profile_name")
else:
raise ValCannotCreateError(serializer.errors)
try:
profile = Profile(profile_name=profile_name)
profile.full_clean()
profile.save()
except ValidationError as err:
raise ValCannotCreateError(err.message_dict)
def get_video_info(edx_video_id, location=None): # pylint: disable=W0613
......@@ -154,11 +144,7 @@ def get_video_info(edx_video_id, location=None): # pylint: disable=W0613
encoded_video: a list of EncodedVideo dicts
url: url of the video
file_size: size of the video in bytes
profile: a dict of encoding details
profile_name: ID of the profile
extension: 3 letter extension of video
width: horizontal pixel resolution
height: vertical pixel resolution
profile: ID of the profile
subtitles: a list of Subtitle dicts
fmt: file format (SRT or SJSON)
language: language code
......
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# The extension, width, and height fields of the Profile model are
# removed, but we want this migration to be non-destructive. Thus, the
# columns are simply altered to allow null values.
db.alter_column('edxval_profile', 'width', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, default=1))
db.alter_column('edxval_profile', 'extension', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, default='mp4'))
db.alter_column('edxval_profile', 'height', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, default=1))
# On MySQL, attempts to insert new model instances (which lack values
# for the removed fields) results in a warning about a lack of a default
# value. Because django does not have a mechanism for specifying the
# default value in the database, we must manually alter the table here.
if db.backend_name == 'mysql':
db.execute("ALTER TABLE edxval_profile MODIFY extension VARCHAR(10) DEFAULT 'mp4'")
db.execute("ALTER TABLE edxval_profile MODIFY width INT(10) UNSIGNED DEFAULT 1")
db.execute("ALTER TABLE edxval_profile MODIFY height INT(10) UNSIGNED DEFAULT 1")
def backwards(self, orm):
# Remove database-level defaults applied above
if db.backend_name == 'mysql':
db.execute("ALTER TABLE edxval_profile MODIFY extension VARCHAR(10)")
db.execute("ALTER TABLE edxval_profile MODIFY width INT(10) UNSIGNED")
db.execute("ALTER TABLE edxval_profile MODIFY height INT(10) UNSIGNED")
# Because the forward migration is non-destructive and simply alters the
# extension, width, and height columns of the Profile model to allow
# null values, values from before the forward migration will still be
# present in the table. The backward migration restores the non-null
# restriction to each column and provides dumb defaults for any profiles
# that were created between the application of the forward migration and
# backward migration.
db.alter_column('edxval_profile', 'width', self.gf('django.db.models.fields.PositiveIntegerField')(default=1))
db.alter_column('edxval_profile', 'extension', self.gf('django.db.models.fields.CharField')(default='mp4', max_length=10))
db.alter_column('edxval_profile', 'height', self.gf('django.db.models.fields.PositiveIntegerField')(default=1))
models = {
'edxval.coursevideo': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideo'},
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'courses'", 'to': "orm['edxval.Video']"})
},
'edxval.encodedvideo': {
'Meta': {'object_name': 'EncodedVideo'},
'bitrate': ('django.db.models.fields.PositiveIntegerField', [], {}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file_size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['edxval.Profile']"}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'encoded_videos'", 'to': "orm['edxval.Video']"})
},
'edxval.profile': {
'Meta': {'object_name': 'Profile'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'profile_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'})
},
'edxval.subtitle': {
'Meta': {'object_name': 'Subtitle'},
'content': ('django.db.models.fields.TextField', [], {'default': "''"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'fmt': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_index': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subtitles'", 'to': "orm['edxval.Video']"})
},
'edxval.video': {
'Meta': {'object_name': 'Video'},
'client_video_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {}),
'edx_video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'status': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
}
}
complete_apps = ['edxval']
......@@ -5,26 +5,9 @@ When calling a serializers' .errors field, there is a priority in which the
errors are returned. This may cause a partial return of errors, starting with
the highest priority.
Example:
class Profile(models.Model)
profile_name = models.CharField(
max_length=50,
unique=True,
validators=[
RegexValidator(
regex=regex,
message='profile_name has invalid characters',
code='invalid profile_name'
),
]
)
extension = models.CharField(max_length=10)
width = models.PositiveIntegerField()
height = models.PositiveIntegerField()
Missing a field, having an input type (expected an int, not a str),
Missing a field, having an incorrect input type (expected an int, not a str),
nested serialization errors, or any similar errors will be returned by
themselves. After these are resolved, errors such as a negative height, or
themselves. After these are resolved, errors such as a negative file_size or
invalid profile_name will be returned.
"""
......@@ -54,9 +37,6 @@ class Profile(models.Model):
),
]
)
extension = models.CharField(max_length=10)
width = models.PositiveIntegerField()
height = models.PositiveIntegerField()
def __unicode__(self):
return self.profile_name
......
......@@ -10,20 +10,6 @@ from django.core.exceptions import ValidationError
from edxval.models import Profile, Video, EncodedVideo, Subtitle, CourseVideo
class ProfileSerializer(serializers.ModelSerializer):
"""
Serializer for Profile object.
"""
class Meta: # pylint: disable=C1001, C0111
model = Profile
fields = (
"profile_name",
"extension",
"width",
"height"
)
class EncodedVideoSerializer(serializers.ModelSerializer):
"""
Serializer for EncodedVideo object.
......
......@@ -7,24 +7,9 @@ EDX_VIDEO_ID = "itchyjacket"
"""
Generic Profiles for manually creating profile objects
"""
PROFILE_DICT_MOBILE = dict(
profile_name="mobile",
extension="avi",
width=100,
height=101
)
PROFILE_DICT_DESKTOP = dict(
profile_name="desktop",
extension="mp4",
width=200,
height=2001
)
PROFILE_DICT_YOUTUBE = dict(
profile_name="youtube",
extension="mp4",
width=1280,
height=720
)
PROFILE_MOBILE = "mobile"
PROFILE_DESKTOP = "desktop"
PROFILE_YOUTUBE = "youtube"
"""
Encoded_videos for test_api, does not have profile.
"""
......@@ -112,40 +97,7 @@ VIDEO_DICT_NON_LATIN_ID = dict(
encoded_videos=[],
subtitles=[]
)
PROFILE_DICT_NON_LATIN = dict(
profile_name=u"배고파",
extension="mew",
width=100,
height=300
)
PROFILE_DICT_INVALID_NAME = dict(
profile_name="lo/lol",
extension="mew",
width=100,
height=300
)
PROFILE_DICT_NEGATIVE_WIDTH = dict(
profile_name="mobile",
extension="mew",
width=-100,
height=300
)
PROFILE_DICT_NEGATIVE_HEIGHT = dict(
profile_name="mobile",
extension="mew",
width=100,
height=-300
)
PROFILE_DICT_MISSING_EXTENSION = dict(
profile_name="mobile",
width=100,
height=300
)
PROFILE_DICT_MANY_INVALID = dict(
profile_name="hh/ff",
width=-100,
height="lol",
)
PROFILE_INVALID_NAME = "lo/lol"
"""
Subtitles
"""
......
......@@ -8,7 +8,6 @@ import mock
from django.test import TestCase
from django.db import DatabaseError
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from rest_framework import status
from ddt import ddt, data
......@@ -35,8 +34,8 @@ class CreateVideoTest(TestCase):
"""
Creation of Profile objects that will be used to test video creation
"""
api.create_profile(constants.PROFILE_DICT_DESKTOP)
api.create_profile(constants.PROFILE_DICT_MOBILE)
api.create_profile(constants.PROFILE_DESKTOP)
api.create_profile(constants.PROFILE_MOBILE)
def test_create_video(self):
"""
......@@ -65,24 +64,7 @@ class CreateVideoTest(TestCase):
with self.assertRaises(ValCannotCreateError):
api.create_video(data)
def test_invalid_profile(self):
"""
Tests inputting bad profile type
"""
video_data = dict(
encoded_videos=[
dict(
profile=constants.PROFILE_DICT_MOBILE,
**constants.ENCODED_VIDEO_DICT_MOBILE
)
],
**constants.VIDEO_DICT_FISH
)
with self.assertRaises(ValidationError):
api.create_video(video_data)
@ddt
class CreateProfileTest(TestCase):
"""
Tests the create_profile function in the api.py
......@@ -92,29 +74,26 @@ class CreateProfileTest(TestCase):
"""
Tests the creation of a profile
"""
result = api.create_profile(constants.PROFILE_DICT_DESKTOP)
result = api.create_profile(constants.PROFILE_DESKTOP)
profiles = list(Profile.objects.all())
self.assertEqual(len(profiles), 6)
self.assertEqual(
profiles[-1].profile_name,
constants.PROFILE_DICT_DESKTOP.get('profile_name')
constants.PROFILE_DESKTOP
)
self.assertEqual(len(profiles), 6)
self.assertEqual("desktop", result)
@data(
constants.PROFILE_DICT_NEGATIVE_WIDTH,
constants.PROFILE_DICT_NEGATIVE_HEIGHT,
constants.PROFILE_DICT_MISSING_EXTENSION,
constants.PROFILE_DICT_MANY_INVALID,
constants.PROFILE_DICT_INVALID_NAME,
)
def test_invalid_create_profile(self, data): # pylint: disable=W0621
def test_invalid_create_profile(self):
"""
Tests the creation of invalid profile data
"""
with self.assertRaises(ValCannotCreateError):
api.create_profile(data)
api.create_profile(constants.PROFILE_INVALID_NAME)
def test_create_profile_duplicate(self):
api.create_profile(constants.PROFILE_DESKTOP)
with self.assertRaises(ValCannotCreateError):
api.create_profile(constants.PROFILE_DESKTOP)
class GetVideoInfoTest(TestCase):
......@@ -126,8 +105,8 @@ class GetVideoInfoTest(TestCase):
"""
Creates EncodedVideo objects in database
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
video = Video.objects.create(**constants.VIDEO_DICT_FISH)
EncodedVideo.objects.create(
video=video,
......@@ -211,8 +190,8 @@ class GetUrlsForProfileTest(TestCase):
"""
Creates EncodedVideo objects in database
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
video = Video.objects.create(**constants.VIDEO_DICT_FISH)
EncodedVideo.objects.create(
video=Video.objects.get(
......@@ -280,8 +259,8 @@ class GetVideoForCourseProfiles(TestCase):
Creates two videos with 2 encoded videos for the first course, and then
2 videos with 1 encoded video for the second course.
"""
mobile_profile = Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
desktop_profile = Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
mobile_profile = Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
desktop_profile = Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
self.course_id = 'test-course'
# 1st video
......@@ -359,13 +338,13 @@ class GetVideoForCourseProfiles(TestCase):
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_FISH,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE
}
))
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_STAR,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE2
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE2
}))
self.assertEqual(videos, expected_dict)
......@@ -380,15 +359,15 @@ class GetVideoForCourseProfiles(TestCase):
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_FISH,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE,
constants.PROFILE_DICT_DESKTOP["profile_name"]: constants.ENCODED_VIDEO_DICT_DESKTOP,
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE,
constants.PROFILE_DESKTOP: constants.ENCODED_VIDEO_DICT_DESKTOP,
}
))
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_STAR,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE2,
constants.PROFILE_DICT_DESKTOP["profile_name"]: constants.ENCODED_VIDEO_DICT_DESKTOP2,
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE2,
constants.PROFILE_DESKTOP: constants.ENCODED_VIDEO_DICT_DESKTOP2,
}
))
self.assertEqual(videos, expected_dict)
......@@ -412,13 +391,13 @@ class GetVideoForCourseProfiles(TestCase):
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_FISH,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE
}
))
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_STAR,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE2
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE2
}
))
self.assertEqual(videos, expected_dict)
......@@ -434,7 +413,7 @@ class GetVideoForCourseProfiles(TestCase):
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_TREE,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE3
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE3
}
))
self.assertEqual(videos, expected_dict)
......@@ -446,7 +425,7 @@ class GetVideoForCourseProfiles(TestCase):
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_PLANT,
{
constants.PROFILE_DICT_DESKTOP["profile_name"]: constants.ENCODED_VIDEO_DICT_DESKTOP3
constants.PROFILE_DESKTOP: constants.ENCODED_VIDEO_DICT_DESKTOP3
}
))
self.assertEqual(videos, expected_dict)
......@@ -462,13 +441,13 @@ class GetVideoForCourseProfiles(TestCase):
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_FISH,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE,
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE,
}
))
expected_dict.update(self._create_video_dict(
constants.VIDEO_DICT_STAR,
{
constants.PROFILE_DICT_MOBILE["profile_name"]: constants.ENCODED_VIDEO_DICT_MOBILE2
constants.PROFILE_MOBILE: constants.ENCODED_VIDEO_DICT_MOBILE2
}
))
self.assertEqual(videos, expected_dict)
......@@ -483,8 +462,8 @@ class GetVideosForIds(TestCase):
"""
Creates EncodedVideo objects in database
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
video = Video.objects.create(**constants.VIDEO_DICT_FISH)
EncodedVideo.objects.create(
video=Video.objects.get(
......@@ -592,8 +571,8 @@ class GetVideoInfoTestWithHttpCalls(APIAuthTestCase):
database via HTTP uploads.
"""
super(GetVideoInfoTestWithHttpCalls, self).setUp()
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
url = reverse('video-list')
response = self.client.post(
url, constants.COMPLETE_SET_FISH, format='json'
......
......@@ -8,7 +8,6 @@ from django.test import TestCase
from edxval.serializers import (
EncodedVideoSerializer,
ProfileSerializer,
VideoSerializer,
ValidationError,
)
......@@ -22,11 +21,14 @@ class SerializerTests(TestCase):
"""
def setUp(self):
"""
Creates Profile objects
Creates Profile objects and a video object
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(**constants.PROFILE_DICT_NON_LATIN)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
Video.objects.create(
duration=0,
edx_video_id=constants.VIDEO_DICT_NON_LATIN_ID["edx_video_id"]
)
def test_negative_fields_for_encoded_video_serializer(self):
"""
......@@ -60,8 +62,10 @@ class SerializerTests(TestCase):
"""
# TODO not the best test. Need to understand what result we want
self.assertIsInstance(
ProfileSerializer(Profile.objects.get(profile_name="배고파")),
ProfileSerializer
VideoSerializer(
Video.objects.get(edx_video_id=constants.VIDEO_DICT_NON_LATIN_ID["edx_video_id"])
),
VideoSerializer
)
def test_invalid_edx_video_id(self):
......
......@@ -18,8 +18,8 @@ class VideoDetail(APIAuthTestCase):
"""
Used for manually creating profile objects which EncodedVideos require.
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
super(VideoDetail, self).setUp()
# Tests for successful PUT requests.
......@@ -321,8 +321,8 @@ class VideoListTest(APIAuthTestCase):
"""
Used for manually creating profile objects which EncodedVideos require.
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
super(VideoListTest, self).setUp()
def tearDown(self):
......@@ -573,8 +573,8 @@ class VideoDetailTest(APIAuthTestCase):
"""
Used for manually creating profile objects which EncodedVideos require.
"""
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
super(VideoDetailTest, self).setUp()
def test_get_all_videos(self):
......@@ -615,8 +615,8 @@ class SubtitleDetailTest(APIAuthTestCase):
Tests for subtitle API
"""
def setUp(self):
Profile.objects.create(**constants.PROFILE_DICT_MOBILE)
Profile.objects.create(**constants.PROFILE_DICT_DESKTOP)
Profile.objects.create(profile_name=constants.PROFILE_MOBILE)
Profile.objects.create(profile_name=constants.PROFILE_DESKTOP)
super(SubtitleDetailTest, self).setUp()
def test_get_subtitle_content(self):
......
......@@ -11,7 +11,6 @@ from django.views.decorators.http import last_modified
from edxval.models import Video, Profile, Subtitle
from edxval.serializers import (
VideoSerializer,
ProfileSerializer,
SubtitleSerializer
)
......@@ -77,17 +76,6 @@ class VideoList(generics.ListCreateAPIView):
return qset
class ProfileList(generics.ListCreateAPIView):
"""
GETs or POST video objects
"""
authentication_classes = (OAuth2Authentication, SessionAuthentication)
permission_classes = (ReadRestrictedDjangoModelPermissions,)
queryset = Profile.objects.all()
lookup_field = "profile_name"
serializer_class = ProfileSerializer
class VideoDetail(generics.RetrieveUpdateDestroyAPIView):
"""
Gets a video instance given its edx_video_id
......
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