Commit b059bd35 by muzaffaryousaf

Fixing/Refactoring tests to get green build.

parent 6f9ad5c3
"""
Start Celery Worker
"""
from __future__ import absolute_import from __future__ import absolute_import
import os
from celery import Celery from celery import Celery
import yaml import yaml
"""
Start Celery Worker
""" from control.veda_deliver import VedaDelivery
try:
from control.control_env import *
except:
from control_env import *
try:
from control.veda_deliver import VedaDelivery
except:
from veda_deliver import VedaDelivery
auth_yaml = os.path.join( auth_yaml = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
...@@ -48,6 +43,7 @@ app.conf.update( ...@@ -48,6 +43,7 @@ app.conf.update(
CELERY_ACCEPT_CONTENT=['pickle', 'json', 'msgpack', 'yaml'] CELERY_ACCEPT_CONTENT=['pickle', 'json', 'msgpack', 'yaml']
) )
@app.task(name='worker_encode') @app.task(name='worker_encode')
def worker_task_fire(veda_id, encode_profile, jobid): def worker_task_fire(veda_id, encode_profile, jobid):
pass pass
...@@ -55,12 +51,14 @@ def worker_task_fire(veda_id, encode_profile, jobid): ...@@ -55,12 +51,14 @@ def worker_task_fire(veda_id, encode_profile, jobid):
@app.task(name='supervisor_deliver') @app.task(name='supervisor_deliver')
def deliverable_route(veda_id, encode_profile): def deliverable_route(veda_id, encode_profile):
"""
VD = VedaDelivery( Task for deliverable route.
"""
veda_deliver = VedaDelivery(
veda_id=veda_id, veda_id=veda_id,
encode_profile=encode_profile encode_profile=encode_profile
) )
VD.run() veda_deliver.run()
@app.task @app.task
......
...@@ -63,7 +63,7 @@ class TestEncode(TestCase): ...@@ -63,7 +63,7 @@ class TestEncode(TestCase):
).delete() ).delete()
encode_list = self.E.determine_encodes() encode_list = self.E.determine_encodes()
baseline = len(encode_list) baseline = len(encode_list)
self.assertTrue(isinstance(encode_list, list)) self.assertTrue(isinstance(encode_list, set))
self.E.encode_list = set() self.E.encode_list = set()
url = URL( url = URL(
......
...@@ -8,11 +8,10 @@ import sys ...@@ -8,11 +8,10 @@ import sys
from django.test import TestCase from django.test import TestCase
from datetime import timedelta from datetime import timedelta
from ddt import data, ddt, unpack from ddt import data, ddt, unpack
from pytest import skip from unittest import skip
import responses import responses
from django.utils.timezone import utc from django.utils.timezone import utc
from mock import PropertyMock, patch from mock import PropertyMock, patch
import yaml
from control.veda_heal import VedaHeal from control.veda_heal import VedaHeal
from VEDA_OS01.models import URL, Course, Destination, Encode, Video from VEDA_OS01.models import URL, Course, Destination, Encode, Video
...@@ -24,6 +23,7 @@ sys.path.append(os.path.dirname(os.path.dirname( ...@@ -24,6 +23,7 @@ sys.path.append(os.path.dirname(os.path.dirname(
CONFIG_DATA = get_config('test_config.yaml') CONFIG_DATA = get_config('test_config.yaml')
@ddt @ddt
class HealTests(TestCase): class HealTests(TestCase):
""" """
...@@ -32,15 +32,11 @@ class HealTests(TestCase): ...@@ -32,15 +32,11 @@ class HealTests(TestCase):
def setUp(self): def setUp(self):
self.heal_instance = VedaHeal() self.heal_instance = VedaHeal()
self.auth_yaml = os.path.join(
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
'instance_config.yaml'
)
self.encode_list = set() self.encode_list = set()
with open(self.auth_yaml, 'r') as stream:
for key, entry in yaml.load(stream)['encode_dict'].items(): for key, entry in CONFIG_DATA['encode_dict'].items():
for e in entry: for e in entry:
self.encode_list.add(e) self.encode_list.add(e)
self.video_id = '12345' self.video_id = '12345'
self.course_object = Course.objects.create( self.course_object = Course.objects.create(
......
...@@ -39,16 +39,9 @@ class TestVALAPI(TestCase): ...@@ -39,16 +39,9 @@ class TestVALAPI(TestCase):
val_status='complete' val_status='complete'
) )
self.auth_yaml = os.path.join( self.auth_yaml = CONFIG_DATA
os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'instance_config.yaml'
)
def test_val_setup(self): def test_val_setup(self):
if not os.path.exists(self.auth_yaml):
self.assertTrue(self.VAC.auth_dict is None)
return None
# register val url to send api response # register val url to send api response
responses.add(responses.POST, CONFIG_DATA['val_token_url'], '{"access_token": "1234567890"}', status=200) responses.add(responses.POST, CONFIG_DATA['val_token_url'], '{"access_token": "1234567890"}', status=200)
...@@ -65,10 +58,6 @@ class TestVALAPI(TestCase): ...@@ -65,10 +58,6 @@ class TestVALAPI(TestCase):
@responses.activate @responses.activate
def test_val_connection(self): def test_val_connection(self):
if not os.path.exists(self.auth_yaml):
self.assertTrue(self.VAC.auth_dict is None)
return None
# register val url to send api response # register val url to send api response
responses.add(responses.POST, CONFIG_DATA['val_token_url'], '{"access_token": "1234567890"}', status=200) responses.add(responses.POST, CONFIG_DATA['val_token_url'], '{"access_token": "1234567890"}', status=200)
responses.add(responses.GET, CONFIG_DATA['val_api_url'], status=200) responses.add(responses.GET, CONFIG_DATA['val_api_url'], status=200)
......
...@@ -119,7 +119,8 @@ class VedaHeal(object): ...@@ -119,7 +119,8 @@ class VedaHeal(object):
course_object=video_object.inst_class, course_object=video_object.inst_class,
).determine_encodes() ).determine_encodes()
try: try:
uncompleted_encodes.remove('review') if uncompleted_encodes:
uncompleted_encodes.remove('review')
except ValueError: except ValueError:
pass pass
......
...@@ -5,6 +5,9 @@ import subprocess ...@@ -5,6 +5,9 @@ import subprocess
import fnmatch import fnmatch
import django import django
from control.control_env import FFPROBE
from VEDA_OS01.models import Video
""" """
VEDA Intake/Product Final Testing Suite VEDA Intake/Product Final Testing Suite
...@@ -15,10 +18,9 @@ image files (which read as 0:00 duration or N/A) ...@@ -15,10 +18,9 @@ image files (which read as 0:00 duration or N/A)
Mismatched Durations (within 5 sec) Mismatched Durations (within 5 sec)
""" """
from control_env import *
class Validation(): class Validation(object):
""" """
Expects a full filepath Expects a full filepath
""" """
...@@ -43,7 +45,6 @@ class Validation(): ...@@ -43,7 +45,6 @@ class Validation():
FFPROBE, FFPROBE,
"\"" + self.videofile + "\"" "\"" + self.videofile + "\""
)) ))
""" """
Test if size is zero Test if size is zero
""" """
...@@ -61,6 +62,10 @@ class Validation(): ...@@ -61,6 +62,10 @@ class Validation():
if "multiple edit list entries, a/v desync might occur, patch welcome" in line: if "multiple edit list entries, a/v desync might occur, patch welcome" in line:
return False return False
if "command not found" in line:
print line
return False
if "Duration: " in line: if "Duration: " in line:
if "Duration: 00:00:00.0" in line: if "Duration: 00:00:00.0" in line:
return False return False
......
...@@ -27,6 +27,26 @@ val_username: username ...@@ -27,6 +27,26 @@ val_username: username
val_transcript_create_url: http://val.edx.org/transcript/create val_transcript_create_url: http://val.edx.org/transcript/create
val_video_transcript_status_url: http://val.edx.org/video/status val_video_transcript_status_url: http://val.edx.org/video/status
# ----------
##---
# This is a list of encodes and their respective course
# boolean matches
encode_dict:
review_proc:
- review
mobile_override:
- override
s3_proc:
- mobile_high
- mobile_low
- audio_mp3
- desktop_webm
- desktop_mp4
- hls
yt_proc:
- youtube
# This is a list of encode profiles and their val profile matches # This is a list of encode profiles and their val profile matches
# boolean matches # boolean matches
val_profile_dict: val_profile_dict:
......
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