Skip to content

Commit 0479f96

Browse files
author
Alex Schworer
committed
Implement unit tests with mock
1 parent e574bbb commit 0479f96

15 files changed

+950
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ python:
66
- "pypy"
77
install: pip install -e .
88
# command to run tests
9-
script: python test/test_zencoder.py
9+
script: nosetests
1010

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
url='http://github.com/schworer/zencoder-py',
1212
license="MIT License",
1313
install_requires=['requests>=1.0'],
14+
tests_require=['mock', 'nose'],
1415
packages=['zencoder'],
1516
platforms='any',
1617
classifiers=[
@@ -19,7 +20,6 @@
1920
'License :: OSI Approved :: MIT License',
2021
'Operating System :: OS Independent',
2122
'Programming Language :: Python',
22-
'Programming Language :: Python :: 2.5',
2323
'Programming Language :: Python :: 2.6',
2424
'Programming Language :: Python :: 2.7',
2525
'Topic :: Software Development :: Libraries :: Python Modules'

test/fixtures/account_create.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"api_key": "abcd1234",
3+
"password": "foo"
4+
}

test/fixtures/account_details.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"account_state": "active",
3+
"plan": "Growth",
4+
"minutes_used": 12549,
5+
"minutes_included": 25000,
6+
"billing_state": "active",
7+
"integration_mode":true
8+
}

test/fixtures/job_create.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"outputs": [
3+
{
4+
"label": null,
5+
"url": "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20130505/7a9f3b6947c27305079fb105dbfc529e/34356e4d54f0c8fb9c3273203937e795.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=Tp9WVinpXKE%2FPrP2M08r54U4EQ0%3D&Expires=1367817210",
6+
"id": 93461812
7+
}
8+
],
9+
"id": 45492475
10+
}

test/fixtures/job_details.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"job": {
3+
"submitted_at": "2013-05-04T21:36:39-07:00",
4+
"state": "finished",
5+
"privacy": false,
6+
"input_media_file": {
7+
"video_codec": "h264",
8+
"frame_rate": 30,
9+
"channels": "2",
10+
"audio_codec": "aac",
11+
"audio_bitrate_in_kbps": 50,
12+
"state": "finished",
13+
"format": "mpeg4",
14+
"audio_sample_rate": 44100,
15+
"privacy": false,
16+
"height": 720,
17+
"error_message": null,
18+
"url": "s3://test-bucket/test.mov",
19+
"video_bitrate_in_kbps": 1402,
20+
"md5_checksum": null,
21+
"duration_in_ms": 5067,
22+
"test": false,
23+
"id": 45469002,
24+
"finished_at": "2013-05-04T21:36:46-07:00",
25+
"updated_at": "2013-05-04T21:37:12-07:00",
26+
"created_at": "2013-05-04T21:36:39-07:00",
27+
"total_bitrate_in_kbps": 1452,
28+
"width": 1280,
29+
"error_class": null,
30+
"file_size_bytes": 922620
31+
},
32+
"test": false,
33+
"id": 45491013,
34+
"finished_at": "2013-05-04T21:37:12-07:00",
35+
"updated_at": "2013-05-04T21:37:12-07:00",
36+
"created_at": "2013-05-04T21:36:39-07:00",
37+
"thumbnails": [],
38+
"output_media_files": [
39+
{
40+
"video_codec": "h264",
41+
"frame_rate": 30,
42+
"channels": "2",
43+
"audio_codec": "aac",
44+
"audio_bitrate_in_kbps": 90,
45+
"state": "finished",
46+
"format": "mpeg4",
47+
"audio_sample_rate": 44100,
48+
"label": null,
49+
"privacy": false,
50+
"height": 720,
51+
"error_message": null,
52+
"url": "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20130505/fc7f7df4f3eacd6fe4ee88cab28732de/dfc2f1b4eb49ea9ab914c84de6d392fb.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=lAc18iXd4ta1Ct0JyazKwYSwdOk%3D&Expires=1367815032",
53+
"video_bitrate_in_kbps": 1440,
54+
"md5_checksum": null,
55+
"duration_in_ms": 5130,
56+
"test": false,
57+
"id": 93457943,
58+
"finished_at": "2013-05-04T21:37:12-07:00",
59+
"updated_at": "2013-05-04T21:37:12-07:00",
60+
"created_at": "2013-05-04T21:36:39-07:00",
61+
"total_bitrate_in_kbps": 1530,
62+
"width": 1280,
63+
"error_class": null,
64+
"file_size_bytes": 973430
65+
}
66+
],
67+
"pass_through": null
68+
}
69+
}

0 commit comments

Comments
 (0)