From 511058205cebf5a419d67ffc18503b33e1d5c793 Mon Sep 17 00:00:00 2001 From: boyska Date: Thu, 27 Feb 2014 13:30:52 +0100 Subject: [PATCH] FIX unit tests --- server/test_forge.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/server/test_forge.py b/server/test_forge.py index 42b674d..16f6058 100644 --- a/server/test_forge.py +++ b/server/test_forge.py @@ -1,14 +1,17 @@ from datetime import datetime, timedelta -from nose.tools import raises, assert_items_equal, eq_ +from nose.tools import raises, eq_ from forge import get_files_and_intervals, get_timefile_exact, round_timefile,\ get_timefile, mp3_join +from config_manager import get_config eight = datetime(2014, 5, 30, 20) nine = datetime(2014, 5, 30, 21) ten = datetime(2014, 5, 30, 22) +get_config()['AUDIO_INPUT'] = '' +get_config()['AUDIO_INPUT_FORMAT'] = '%Y-%m/%d/%Y-%m-%d-%H-%M-%S.mp3' def minutes(n): return timedelta(minutes=n) @@ -22,7 +25,7 @@ def seconds(n): def test_timefile_exact(): eq_(get_timefile_exact(eight), - '2014-05/30/rec-2014-05-30-20-00-00-ror.mp3') + '2014-05/30/2014-05-30-20-00-00.mp3') ## Rounding @@ -42,12 +45,12 @@ def test_rounding_value(): def test_timefile_alreadyround(): eq_(get_timefile(eight), - '2014-05/30/rec-2014-05-30-20-00-00-ror.mp3') + '2014-05/30/2014-05-30-20-00-00.mp3') def test_timefile_toround(): eq_(get_timefile(eight + minutes(20)), - '2014-05/30/rec-2014-05-30-20-00-00-ror.mp3') + '2014-05/30/2014-05-30-20-00-00.mp3') ## Intervals @@ -158,29 +161,29 @@ def test_intervals_left_2(): def test_mp3_1(): eq_(' '.join(mp3_join((('a', 0, 0),), 'foo.mp3')), - 'ffmpeg -i concat:a -codec:a copy foo.mp3') + 'ffmpeg -i concat:a -acodec copy foo.mp3 -loglevel warning') def test_mp3_1_left(): eq_(' '.join(mp3_join((('a', 160, 0),), 'foo.mp3')), - 'ffmpeg -i concat:a -codec:a copy -ss 160 foo.mp3') + 'ffmpeg -i concat:a -acodec copy -ss 160 foo.mp3 -loglevel warning') def test_mp3_1_right(): eq_(' '.join(mp3_join((('a', 0, 1600),), 'foo.mp3')), - 'ffmpeg -i concat:a -codec:a copy -to 2000 foo.mp3') + 'ffmpeg -i concat:a -acodec copy -t 2000 foo.mp3 -loglevel warning') def test_mp3_1_leftright(): eq_(' '.join(mp3_join((('a', 160, 1600),), 'foo.mp3')), - 'ffmpeg -i concat:a -codec:a copy -ss 160 -to 2000 foo.mp3') + 'ffmpeg -i concat:a -acodec copy -ss 160 -t 1840 foo.mp3 -loglevel warning') def test_mp3_2(): eq_(' '.join(mp3_join((('a', 0, 0), ('b', 0, 0)), 'foo.mp3')), - 'ffmpeg -i concat:a|b -codec:a copy foo.mp3') + 'ffmpeg -i concat:a|b -acodec copy foo.mp3 -loglevel warning') def test_mp3_2_leftright(): eq_(' '.join(mp3_join((('a', 1000, 0), ('b', 0, 1600)), 'foo.mp3')), - 'ffmpeg -i concat:a|b -codec:a copy -ss 1000 -to 5600 foo.mp3') + 'ffmpeg -i concat:a|b -acodec copy -ss 1000 -t 4600 foo.mp3 -loglevel warning')