removed useless tests

This commit is contained in:
Rudi Grinberg 2012-11-02 15:05:08 -04:00
parent c79b28aa90
commit dfc3cf9267
3 changed files with 0 additions and 233 deletions

View File

@ -1,100 +0,0 @@
<?php
// Define path to application directory
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../application'));
echo APPLICATION_PATH.PHP_EOL;
// Ensure library/ is on include_path
set_include_path(get_include_path() . PATH_SEPARATOR . realpath(APPLICATION_PATH . '/../library'));
set_include_path(get_include_path() . PATH_SEPARATOR . APPLICATION_PATH . '/models');
echo get_include_path().PHP_EOL;
//Controller plugins.
set_include_path(APPLICATION_PATH . get_include_path() . PATH_SEPARATOR . '/controllers/plugins');
require_once APPLICATION_PATH.'/configs/conf.php';
require_once(APPLICATION_PATH.'/../library/propel/runtime/lib/Propel.php');
require_once 'Soundcloud.php';
require_once 'Playlist.php';
require_once 'StoredFile.php';
require_once 'Schedule.php';
require_once 'Shows.php';
require_once 'User.php';
require_once 'RabbitMq.php';
require_once 'Preference.php';
//require_once APPLICATION_PATH.'/controllers/plugins/RabbitMqPlugin.php';
// Initialize Propel with the runtime configuration
Propel::init(__DIR__."/../../../application/configs/airtime-conf.php");
$playlistName = "pypo_playlist_test";
$secondsFromNow = 30;
echo " ************************************************************** \n";
echo " This script schedules a playlist to play $secondsFromNow minute(s) from now.\n";
echo " This is a utility to help you debug the scheduler.\n";
echo " ************************************************************** \n";
echo "\n";
echo "Deleting playlists with the name '$playlistName'...";
// Delete any old playlists
$pl2 = Playlist::findPlaylistByName($playlistName);
foreach ($pl2 as $playlist) {
//var_dump($playlist);
$playlist->delete();
}
echo "done.\n";
// Create a new playlist
echo "Creating new playlist '$playlistName'...";
$pl = new Playlist();
$pl->create($playlistName);
$mediaFile = Application_Model_StoredFile::findByOriginalName("Peter_Rudenko_-_Opening.mp3");
if (is_null($mediaFile)) {
echo "Adding test audio clip to the database.\n";
$v = array("filepath" => __DIR__."/../../../audio_samples/vorbis.com/Hydrate-Kenny_Beltrey.ogg");
$mediaFile = Application_Model_StoredFile::Insert($v);
}
$pl->addAudioClip($mediaFile->getId());
echo "done.\n";
//$pl2 = Playlist::findPlaylistByName("pypo_playlist_test");
//var_dump($pl2);
// Get current time
// In the format YYYY-MM-DD HH:MM:SS.nnnnnn
$startTime = date("Y-m-d H:i:s");
$endTime = date("Y-m-d H:i:s", time()+(60*60));
echo "Removing everything from the scheduler between $startTime and $endTime...";
// Check for succces
$scheduleClear = Schedule::isScheduleEmptyInRange($startTime, "01:00:00");
if (!$scheduleClear) {
echo "\nERROR: Schedule could not be cleared.\n\n";
var_dump(Schedule::getItems($startTime, $endTime));
exit;
}
echo "done.\n";
// Schedule the playlist for two minutes from now
echo "Scheduling new playlist...\n";
//$playTime = date("Y-m-d H:i:s", time()+(60*$minutesFromNow));
$playTime = date("Y-m-d H:i:s", time()+($secondsFromNow));
//$scheduleGroup = new ScheduleGroup();
//$scheduleGroup->add($playTime, null, $pl->getId());
//$show = new Application_Model_ShowInstance($showInstanceId);
//$show->scheduleShow(array($pl->getId()));
//$show->setShowStart();
//$show->setShowEnd();
echo " SUCCESS: Playlist scheduled at $playTime\n\n";

View File

@ -1,59 +0,0 @@
[loggers]
keys=root
[handlers]
keys=consoleHandler,fileHandlerERROR,fileHandlerDEBUG,nullHandler
[formatters]
keys=simpleFormatter
[logger_root]
level=DEBUG
handlers=consoleHandler,fileHandlerERROR,fileHandlerDEBUG
[logger_libs]
handlers=nullHandler
level=CRITICAL
qualname="process"
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=CRITICAL
formatter=simpleFormatter
args=(sys.stdout,)
[handler_fileHandlerERROR]
class=FileHandler
level=CRITICAL
formatter=simpleFormatter
args=("./error-unit-test.log",)
[handler_fileHandlerDEBUG]
class=FileHandler
level=CRITICAL
formatter=simpleFormatter
args=("./debug-unit-test.log",)
[handler_nullHandler]
class=FileHandler
level=CRITICAL
formatter=simpleFormatter
args=("./log-null-unit-test.log",)
[formatter_simpleFormatter]
format=%(asctime)s %(levelname)s - [%(filename)s : %(funcName)s() : line %(lineno)d] - %(message)s
datefmt=
## multitail color sheme
## pyml / python
# colorscheme:pyml:www.obp.net
# cs_re:blue:\[[^ ]*\]
# cs_re:red:CRITICAL:*
# cs_re:red,black,blink:ERROR:*
# cs_re:blue:NOTICE:*
# cs_re:cyan:INFO:*
# cs_re:green:DEBUG:*

View File

@ -1,74 +0,0 @@
import time
import os
import traceback
from optparse import *
import sys
import time
import datetime
import logging
import logging.config
import shutil
import urllib
import urllib2
import pickle
import telnetlib
import random
import string
import operator
import inspect
# additional modules (should be checked)
from configobj import ConfigObj
# custom imports
#from util import *
from api_client import AirtimeApiClient
import unittest
# configure logging
#logging.config.fileConfig("logging-api-validator.cfg")
try:
config = ConfigObj('/etc/airtime/pypo.cfg')
except Exception, e:
print 'Error loading config file: ', e
sys.exit()
class TestApiFunctions(unittest.TestCase):
def setUp(self):
self.api_client = AirtimeApiClient()
def test_is_server_compatible(self):
self.assertTrue(self.api_client.is_server_compatible(False))
def test_get_schedule(self):
status, response = self.api_client.get_schedule()
self.assertTrue(response.has_key("status"))
self.assertTrue(response.has_key("playlists"))
self.assertTrue(response.has_key("check"))
self.assertTrue(status == 1)
def test_get_media(self):
self.assertTrue(True)
def test_notify_scheduled_item_start_playing(self):
arr = dict()
arr["x"] = dict()
arr["x"]["schedule_id"]=1
response = self.api_client.notify_scheduled_item_start_playing("x", arr)
self.assertTrue(response.has_key("status"))
self.assertTrue(response.has_key("message"))
def test_notify_media_item_start_playing(self):
response = self.api_client.notify_media_item_start_playing('{"schedule_id":1}', 5)
return response =
self.assertTrue(response.has_key("status"))
self.assertTrue(response.has_key("message"))
if __name__ == '__main__':
unittest.main()