Skip to content

Commit

Permalink
add missing audio_mp3 profile
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammad-ammar committed Feb 7, 2018
1 parent a9decda commit 2612b66
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
30 changes: 30 additions & 0 deletions edxval/migrations/0011_data__add_audio_mp3_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


AUDIO_MP3_PROFILE = 'audio_mp3'


def create_audio_mp3_profile(apps, schema_editor):
""" Create audio_mp3 profile """
Profile = apps.get_model('edxval', 'Profile')
Profile.objects.get_or_create(profile_name=AUDIO_MP3_PROFILE)


def delete_audio_mp3_profile(apps, schema_editor):
""" Delete audio_mp3 profile """
Profile = apps.get_model('edxval', 'Profile')
Profile.objects.filter(profile_name=AUDIO_MP3_PROFILE).delete()


class Migration(migrations.Migration):

dependencies = [
('edxval', '0010_add_video_as_foreign_key'),
]

operations = [
migrations.RunPython(create_audio_mp3_profile, delete_audio_mp3_profile),
]
1 change: 1 addition & 0 deletions edxval/tests/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
PROFILE_DESKTOP = "desktop"
PROFILE_YOUTUBE = "youtube"
PROFILE_HLS = 'hls'
PROFILE_AUDIO_MP3 = 'audio_mp3'
"""
Encoded_videos for test_api, does not have profile.
"""
Expand Down
8 changes: 6 additions & 2 deletions edxval/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def test_create_profile(self):
api.create_profile(constants.PROFILE_DESKTOP)
profiles = list(Profile.objects.all())
profile_names = [unicode(profile) for profile in profiles]
self.assertEqual(len(profiles), 7)
self.assertEqual(len(profiles), 8)
self.assertIn(
constants.PROFILE_DESKTOP,
profile_names
Expand All @@ -227,7 +227,11 @@ def test_create_profile(self):
constants.PROFILE_HLS,
profile_names
)
self.assertEqual(len(profiles), 7)
self.assertIn(
constants.PROFILE_AUDIO_MP3,
profile_names
)
self.assertEqual(len(profiles), 8)

def test_invalid_create_profile(self):
"""
Expand Down

0 comments on commit 2612b66

Please sign in to comment.