Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f79ff41

Browse filesBrowse files
author
Alex Schworer
committed
Add tests for inputs
1 parent 50ee39c commit f79ff41
Copy full SHA for f79ff41

File tree

Expand file treeCollapse file tree

3 files changed

+57
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+57
-0
lines changed

‎test/fixtures/input_details.json

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"audio_sample_rate": 44100,
3+
"frame_rate": 30,
4+
"job_id": 45497494,
5+
"channels": "2",
6+
"audio_bitrate_in_kbps": 50,
7+
"height": 720,
8+
"audio_codec": "aac",
9+
"duration_in_ms": 5067,
10+
"url": "http://s3.amazonaws.com/zencodertesting/test.mov",
11+
"file_size_in_bytes": 922620,
12+
"width": 1280,
13+
"format": "mpeg4",
14+
"state": "finished",
15+
"total_bitrate_in_kbps": 1452,
16+
"video_bitrate_in_kbps": 1402,
17+
"id": 45475483,
18+
"video_codec": "h264",
19+
"privacy": false
20+
}

‎test/fixtures/input_progress.json

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"state": "processing",
3+
"current_event": "Downloading",
4+
"current_event_progress": "32.34567345",
5+
"progress": "45.2353255"
6+
}

‎test/test_inputs.py

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import unittest
2+
from zencoder import Zencoder
3+
4+
from mock import patch
5+
6+
from test_util import TEST_API_KEY, load_response
7+
from zencoder import Zencoder
8+
9+
class TestInputs(unittest.TestCase):
10+
def setUp(self):
11+
self.zen = Zencoder(api_key=TEST_API_KEY)
12+
13+
@patch("requests.Session.get")
14+
def test_input_details(self, get):
15+
get.return_value = load_response(200, 'fixtures/input_details.json')
16+
17+
resp = self.zen.output.details(15432)
18+
self.assertEquals(resp.code, 200)
19+
self.assertTrue(resp.body['id'] > 0)
20+
21+
@patch("requests.Session.get")
22+
def test_input_progress(self, get):
23+
get.return_value = load_response(200, 'fixtures/input_progress.json')
24+
25+
resp = self.zen.output.progress(14325)
26+
self.assertEquals(resp.code, 200)
27+
self.assertEquals(resp.body['state'], 'processing')
28+
29+
if __name__ == "__main__":
30+
unittest.main()
31+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.