Skip to content

Commit 64f9006

Browse files
committed
Merge pull request zencoder#6 from schworer/create_account_cleanup
Create account cleanup
2 parents c7c3c5c + 6901ee9 commit 64f9006

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
MANIFEST
33
dist/
44
env/
5+
build/

test/test_zencoder.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def setUp(self):
99

1010
def test_api_key(self):
1111
""" initialize zencoder object and test api key """
12-
api_key = 'abcd123'
12+
api_key = 'testapikey'
1313
zc = Zencoder(api_key=api_key)
1414
self.assertEquals(zc.api_key, api_key)
1515

@@ -19,6 +19,21 @@ def test_api_key_env_var(self):
1919
zc = Zencoder()
2020
self.assertEquals(zc.api_key, 'abcd123')
2121

22+
def test_default_api_version(self):
23+
os.environ['ZENCODER_API_KEY'] = 'abcd123'
24+
zc = Zencoder()
25+
self.assertEquals(zc.base_url, 'https://app.zencoder.com/api/v2/')
26+
27+
def test_set_api_version(self):
28+
os.environ['ZENCODER_API_KEY'] = 'abcd123'
29+
zc = Zencoder(api_version='v1')
30+
self.assertEquals(zc.base_url, 'https://app.zencoder.com/api/v1/')
31+
32+
def test_set_api_edge_version(self):
33+
os.environ['ZENCODER_API_KEY'] = 'abcd123'
34+
zc = Zencoder(api_version='edge')
35+
self.assertEquals(zc.base_url, 'https://app.zencoder.com/api/')
36+
2237
if __name__ == "__main__":
2338
unittest.main()
2439

zencoder/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from core import Zencoder
22
from core import ZencoderResponseError
33

4+
from core import Account

zencoder/core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def __init__(self, base_url, api_key, as_xml=False, resource_name=None, timeout=
4545
if resource_name:
4646
self.base_url = self.base_url + resource_name
4747

48-
#TODO investigate httplib2 caching and if it is necessary
4948
self.http = httplib2.Http(timeout=timeout)
5049
self.as_xml = as_xml
5150
self.api_key = api_key
@@ -186,12 +185,12 @@ def __init__(self, base_url, api_key=None, as_xml=False, timeout=None):
186185
"""
187186
super(Account, self).__init__(base_url, api_key, as_xml, 'account', timeout=timeout)
188187

189-
def create(self, email, tos=True, options=None):
188+
def create(self, email, tos=1, options=None):
190189
"""
191190
Creates an account with Zencoder, no API Key necessary.
192191
"""
193192
data = {'email': email,
194-
'terms_of_service': int(tos)}
193+
'terms_of_service': str(tos)}
195194
if options:
196195
data.update(options)
197196

0 commit comments

Comments
 (0)