Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: python
python:
- "2.7"
- "3.4"
install:
- pip install -e .
- pip install coveralls
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ChangeLog
0.3.2 (unreleased)
------------------

* No entry.
* Add python 3.4 support.

0.3.1 (2014-12-19)
------------------
Expand Down
7 changes: 3 additions & 4 deletions ocs_sdk/apis/api_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
# file except in compliance with the License. You may obtain a copy of the
# License at http://opensource.org/licenses/BSD-2-Clause

from itertools import izip_longest

from six.moves import zip_longest
import slumber

from . import API
Expand Down Expand Up @@ -63,8 +62,8 @@ def perm_matches(self, request_perm, effective_perm):
effective_perm_parts = effective_perm.split(':')

for (request_perm_part,
effective_perm_part) in izip_longest(request_perm_parts,
effective_perm_parts):
effective_perm_part) in zip_longest(request_perm_parts,
effective_perm_parts):

if (
request_perm_part != effective_perm_part and
Expand Down
4 changes: 2 additions & 2 deletions ocs_sdk/tests/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# License at http://opensource.org/licenses/BSD-2-Clause

import json
import urlparse

import httpretty
from six.moves.urllib.parse import urljoin


class FakeAPITestCase(object):
Expand All @@ -31,7 +31,7 @@ def fake_endpoint(self, api, endpoint, method=httpretty.GET,

httpretty.register_uri(
method,
urlparse.urljoin(api.get_api_url(), endpoint),
urljoin(api.get_api_url(), endpoint),
body=body,
content_type='application/json',
status=status
Expand Down
2 changes: 1 addition & 1 deletion ocs_sdk/tests/apis/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_make_requests_session(self):
).make_requests_session()

self.assertEqual(requests_session.headers.get('X-Auth-Token'),
'0xdeadbeef')
b'0xdeadbeef')
self.assertEqual(requests_session.headers.get('User-Agent'),
'jamesb0nd')

Expand Down
8 changes: 6 additions & 2 deletions ocs_sdk/tests/apis/test_api_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

import json
import unittest
import urlparse
import uuid

import six
from six.moves.urllib.parse import parse_qs, urlparse

from ocs_sdk.apis import MetadataAPI

from . import FakeAPITestCase
Expand Down Expand Up @@ -45,7 +47,7 @@ def fake_route_conf(_, uri, headers):
If no format is given, return a text/plain response with a "shell"
format.
"""
querystring = urlparse.parse_qs(urlparse.urlparse(uri).query)
querystring = parse_qs(urlparse(uri).query)

if 'json' in querystring.get('format', []):
return 200, headers, json.dumps(json_response)
Expand All @@ -64,5 +66,7 @@ def test_get(self):
self.assertEqual(self.api.get_metadata(), expected_response)

shell_response = self.api.get_metadata(as_shell=True)
if not isinstance(shell_response, str): # py3 branch
shell_response = str(shell_response, 'utf-8')
self.assertIn('id="%(id)s"' % expected_response, shell_response)
self.assertIn('name="%(name)s"' % expected_response, shell_response)
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def get_long_description():
license='BSD',

install_requires=[
'slumber >= 0.6.0',
'slumber >= 0.6.2',
'six',
],

packages=find_packages(),
Expand All @@ -67,6 +68,8 @@ def get_long_description():
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
'Topic :: System :: Distributed Computing',
Expand Down