2
2
3
3
# Check if environment is setup to run the tests
4
4
if os .environ .get ('AVTRANSCODER_TEST_AUDIO_WAVE_FILE' ) is None or \
5
- os .environ .get ('AVTRANSCODER_TEST_VIDEO_MP4_FILE' ) is None :
5
+ os .environ .get ('AVTRANSCODER_TEST_AUDIO_MP4_FILE' ) is None or \
6
+ os .environ .get ('AVTRANSCODER_TEST_VIDEO_MOV_FILE' ) is None :
6
7
from nose .plugins .skip import SkipTest
7
8
raise SkipTest ("Need to define environment variables "
8
9
"AVTRANSCODER_TEST_AUDIO_WAVE_FILE and "
9
- "AVTRANSCODER_TEST_VIDEO_MP4_FILE" )
10
+ "AVTRANSCODER_TEST_VIDEO_MP4_FILE and "
11
+ "AVTRANSCODER_TEST_VIDEO_MOV_FILE" )
10
12
11
13
from nose .tools import *
12
14
@@ -38,6 +40,7 @@ def testAddMetadataDate():
38
40
39
41
assert_in ( metadata_to_check , properties .getMetadatas () )
40
42
43
+
41
44
def testAddImpossibleMetadata ():
42
45
"""
43
46
Can't add an impossible metadata to the outputFile.
@@ -94,6 +97,7 @@ def testCheckVideoProperties():
94
97
assert_equals ( round (videoStream .getDuration (), 2 ), expectedDuration )
95
98
assert_equals ( videoStream .getFps (), expectedFps )
96
99
100
+
97
101
def testCheckAudioProperties ():
98
102
"""
99
103
Check properties of an audio stream.
@@ -122,4 +126,19 @@ def testCheckAudioProperties():
122
126
assert_equals ( round (audioStream .getDuration (), 2 ), expectedDuration )
123
127
assert_equals ( audioStream .getChannels (), expectedChannels )
124
128
assert_equals ( audioStream .getChannelLayout (), expectedChannelLayout )
125
- assert_equals ( audioStream .getSampleRate (), expectedSampleRate )
129
+ assert_equals ( audioStream .getSampleRate (), expectedSampleRate )
130
+
131
+
132
+ def testCheckFilePropertiesAsJson ():
133
+ """
134
+ Check file properties as json.
135
+ """
136
+ # get src file
137
+ inputFileName = os .environ ['AVTRANSCODER_TEST_VIDEO_MOV_FILE' ]
138
+ inputFile = av .InputFile ( inputFileName )
139
+
140
+ import json
141
+ # throw exception if it is not a valid JSON
142
+ json .loads (inputFile .getProperties ().getPropertiesAsJson ())
143
+
144
+
0 commit comments