Commit b059bd35 by muzaffaryousaf

Fixing/Refactoring tests to get green build.

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